files setup

This commit is contained in:
Karol Sójko 2023-02-06 07:33:16 +01:00
parent 25066bb33c
commit 51bb1081a6
No known key found for this signature in database
GPG key ID: D966F68E8A92F649
4 changed files with 94 additions and 4 deletions

View file

@ -3,6 +3,12 @@
###########
EXPOSED_PORT=3000
#########
# FILES #
#########
EXPOSED_FILES_SERVER_PORT=3042
PUBLIC_FILES_SERVER_URL=http://localhost:3042
######
# DB #
######

View file

@ -16,6 +16,12 @@ if [ -z "$AUTH_SERVER_PORT" ]; then
export AUTH_SERVER_PORT=3103
fi
if [ -z "$EXPOSED_FILES_SERVER_PORT" ]; then
export FILES_SERVER_PORT=3104
else
export FILES_SERVER_PORT=$EXPOSED_FILES_SERVER_PORT
fi
######
# DB #
######
@ -61,6 +67,10 @@ if [ -z "$AUTH_JWT_SECRET" ]; then
export AUTH_JWT_SECRET=$(openssl rand -hex 32)
fi
if [ -z "$VALET_TOKEN_SECRET" ]; then
export VALET_TOKEN_SECRET=$(openssl rand -base64 32)
fi
########
# AUTH #
########
@ -232,6 +242,58 @@ fi
printenv | grep SYNCING_SERVER_ | sed 's/SYNCING_SERVER_//g' > /opt/server/packages/syncing-server/.env
################
# FILES SERVER #
################
if [ -z "$FILES_SERVER_LOG_LEVEL" ]; then
export FILES_SERVER_LOG_LEVEL="info"
fi
export FILES_SERVER_NODE_ENV="production"
export FILES_SERVER_VERSION="local"
export FILES_SERVER_REDIS_EVENTS_CHANNEL="files-events"
if [ -z "$FILES_SERVER_MAX_CHUNK_BYTES" ]; then
export FILES_SERVER_MAX_CHUNK_BYTES=100000000
fi
export FILES_SERVER_NEW_RELIC_ENABLED=false
if [ -z "$FILES_SERVER_SNS_TOPIC_ARN" ]; then
export FILES_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:files-local-topic"
fi
if [ -z "$FILES_SERVER_SNS_ENDPOINT" ]; then
export FILES_SERVER_SNS_ENDPOINT="http://localstack:4566"
fi
if [ -z "$FILES_SERVER_SNS_SECRET_ACCESS_KEY" ]; then
export FILES_SERVER_SNS_SECRET_ACCESS_KEY="x"
fi
if [ -z "$FILES_SERVER_SNS_ACCESS_KEY_ID" ]; then
export FILES_SERVER_SNS_ACCESS_KEY_ID="x"
fi
if [ -z "$FILES_SERVER_SNS_AWS_REGION" ]; then
export FILES_SERVER_SNS_AWS_REGION="us-east-1"
fi
if [ -z "$FILES_SERVER_SQS_QUEUE_URL" ]; then
export FILES_SERVER_SQS_QUEUE_URL="http://localstack:4566/000000000000/files-local-queue"
fi
if [ -z "$FILES_SERVER_SQS_AWS_REGION" ]; then
export FILES_SERVER_SQS_AWS_REGION="us-east-1"
fi
if [ -z "$FILES_SERVER_SQS_ACCESS_KEY_ID" ]; then
export FILES_SERVER_SQS_ACCESS_KEY_ID="x"
fi
if [ -z "$FILES_SERVER_SQS_SECRET_ACCESS_KEY" ]; then
export FILES_SERVER_SQS_SECRET_ACCESS_KEY="x"
fi
if [ -z "$FILES_SERVER_SQS_ENDPOINT" ]; then
export FILES_SERVER_SQS_ENDPOINT="http://localstack:4566"
fi
printenv | grep FILES_SERVER_ | sed 's/FILES_SERVER_//g' > /opt/server/packages/files/.env
###############
# API GATEWAY #
###############
@ -250,6 +312,11 @@ export API_GATEWAY_SYNCING_SERVER_JS_URL=http://localhost:$SYNCING_SERVER_PORT
export API_GATEWAY_AUTH_SERVER_URL=http://localhost:$AUTH_SERVER_PORT
export API_GATEWAY_WORKSPACE_SERVER_URL=http://localhost:3004
export API_GATEWAY_REVISIONS_SERVER_URL=http://localhost:3005
if [ -z "$PUBLIC_FILES_SERVER_URL" ]; then
export API_GATEWAY_FILES_SERVER_URL=http://localhost:$FILES_SERVER_PORT
else
export API_GATEWAY_FILES_SERVER_URL=$PUBLIC_FILES_SERVER_URL
fi
export API_GATEWAY_REDIS_EVENTS_CHANNEL="api-gateway-event"

View file

@ -40,4 +40,20 @@ command=yarn start:syncing-server-worker
autostart=true
autorestart=true
stdout_logfile=/var/lib/server/logs/syncing-server-worker.log
stderr_logfile=/var/lib/server/logs/syncing-server-worker.err
stderr_logfile=/var/lib/server/logs/syncing-server-worker.err
[program:files]
directory=/opt/server
command=yarn start:files
autostart=true
autorestart=true
stdout_logfile=/var/lib/server/logs/files.log
stderr_logfile=/var/lib/server/logs/files.err
[program:files-worker]
directory=/opt/server
command=yarn start:files-worker
autostart=true
autorestart=true
stdout_logfile=/var/lib/server/logs/files-worker.log
stderr_logfile=/var/lib/server/logs/files-worker.err

View file

@ -27,14 +27,15 @@
"wait-for:db": "docker/wait-for.sh $DB_HOST $DB_PORT",
"wait-for:auth": "docker/wait-for.sh localhost $AUTH_SERVER_PORT",
"wait-for:syncing-server": "docker/wait-for.sh localhost $SYNCING_SERVER_PORT",
"wait-for:files": "docker/wait-for.sh localhost $FILES_SERVER_PORT",
"start:auth": "yarn wait-for:db && yarn workspace @standardnotes/auth-server start",
"start:auth-worker": "yarn wait-for:db && yarn workspace @standardnotes/auth-server worker",
"start:scheduler": "yarn workspace @standardnotes/scheduler-server worker",
"start:syncing-server": "yarn wait-for:db && yarn workspace @standardnotes/syncing-server start",
"start:syncing-server-worker": "yarn wait-for:db && yarn workspace @standardnotes/syncing-server worker",
"start:files": "yarn workspace @standardnotes/files-server start",
"start:files-worker": "yarn workspace @standardnotes/files-server worker",
"start:api-gateway": "yarn wait-for:auth && yarn wait-for:syncing-server && yarn workspace @standardnotes/api-gateway start",
"start:files": "yarn wait-for:db && yarn workspace @standardnotes/files-server start",
"start:files-worker": "yarn wait-for:db && yarn workspace @standardnotes/files-server worker",
"start:api-gateway": "yarn wait-for:auth && yarn wait-for:syncing-server && yarn wait-for:files && yarn workspace @standardnotes/api-gateway start",
"start:websockets": "yarn workspace @standardnotes/websockets-server start",
"start:workspace": "yarn workspace @standardnotes/workspace-server start",
"start:analytics": "yarn workspace @standardnotes/analytics worker",