Standard Notes
The official instructions say to first:
git clone --single-branch --branch main https://github.com/standardnotes/standalone.git
cd standalone
./server.sh setup
And then fill out AUTH_JWT_SECRET in .env and JWT_SECRET, LEGACY_JWT_SECRET, PSEUDO_KEY_PARAMS_KEY and ENCRYPTION_SERVER_KEY in docker/auth.env.
docker-compose.yml
version: '3.8'
services:
syncing-server-js:
image: standardnotes/syncing-server-js:1.35.2
container_name: 'standardnotes-syncing-server'
depends_on:
- db
- cache
entrypoint: [
"./wait-for.sh", "db", "3306",
"./wait-for.sh", "cache", "6379",
"./docker/entrypoint.sh", "start-web"
]
env_file: .env
environment:
PORT: 3000
restart: always
networks:
- "standardnotes_standalone"
syncing-server-js-worker:
image: standardnotes/syncing-server-js:1.35.2
container_name: 'standardnotes-syncing-server-worker'
depends_on:
- db
- cache
- syncing-server-js
entrypoint: [
"./wait-for.sh", "db", "3306",
"./wait-for.sh", "cache", "6379",
"./wait-for.sh", "syncing-server-js", "3000",
"./docker/entrypoint.sh", "start-worker"
]
env_file: .env
environment:
PORT: 3000
restart: always
networks:
- "standardnotes_standalone"
api-gateway:
image: standardnotes/api-gateway:1.20.0
container_name: 'standardnotes-api-gateway'
restart: always
depends_on:
- auth
- syncing-server-js
env_file: docker/api-gateway.env
#ports:
# - ${EXPOSED_PORT}:3000
environment:
PORT: 3000
AUTH_JWT_SECRET: '${AUTH_JWT_SECRET}'
entrypoint: [
"./wait-for.sh", "auth", "3000",
"./wait-for.sh", "syncing-server-js", "3000",
"./docker/entrypoint.sh", "start-web"
]
labels:
- "traefik.enable=true"
- "traefik.http.routers.standardnotes.rule=Host(`notesync.zcyph.cc`)"
- "traefik.http.routers.standardnotes.entrypoints=https"
- "traefik.http.routers.standardnotes.tls.certresolver=cloudflare"
- "traefik.http.services.standardnotes.loadbalancer.server.port=3000"
- "traefik.docker.network=traefik"
networks:
- "standardnotes_standalone"
- "traefik"
auth:
image: standardnotes/auth:1.11.0
container_name: 'standardnotes-auth'
restart: always
depends_on:
- db
- cache
- syncing-server-js
entrypoint: [
"./wait-for.sh", "db", "3306",
"./wait-for.sh", "cache", "6379",
"./wait-for.sh", "syncing-server-js", "3000",
"./docker/entrypoint.sh", "start-web"
]
env_file: docker/auth.env
environment:
PORT: 3000
DB_HOST: '${DB_HOST}'
DB_REPLICA_HOST: '${DB_REPLICA_HOST}'
DB_PORT: '${DB_PORT}'
DB_DATABASE: '${DB_DATABASE}'
DB_USERNAME: '${DB_USERNAME}'
DB_PASSWORD: '${DB_PASSWORD}'
DB_DEBUG_LEVEL: '${DB_DEBUG_LEVEL}'
DB_MIGRATIONS_PATH: '${DB_MIGRATIONS_PATH}'
REDIS_URL: '${REDIS_URL}'
AUTH_JWT_SECRET: '${AUTH_JWT_SECRET}'
networks:
- "standardnotes_standalone"
auth-worker:
image: standardnotes/auth:1.11.0
container_name: 'standardnotes-auth-worker'
restart: always
depends_on:
- db
- cache
- auth
entrypoint: [
"./wait-for.sh", "db", "3306",
"./wait-for.sh", "cache", "6379",
"./wait-for.sh", "auth", "3000",
"./docker/entrypoint.sh", "start-worker"
]
env_file: docker/auth.env
environment:
PORT: 3000
DB_HOST: '${DB_HOST}'
DB_REPLICA_HOST: '${DB_REPLICA_HOST}'
DB_PORT: '${DB_PORT}'
DB_DATABASE: '${DB_DATABASE}'
DB_USERNAME: '${DB_USERNAME}'
DB_PASSWORD: '${DB_PASSWORD}'
DB_DEBUG_LEVEL: '${DB_DEBUG_LEVEL}'
DB_MIGRATIONS_PATH: '${DB_MIGRATIONS_PATH}'
REDIS_URL: '${REDIS_URL}'
AUTH_JWT_SECRET: '${AUTH_JWT_SECRET}'
networks:
- "standardnotes_standalone"
db:
image: mysql:5.6
container_name: 'standardnotes-db'
environment:
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
#ports:
# - 3306
restart: always
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_general_ci
volumes:
- ./data/mysql:/var/lib/mysql
- ./data/import:/docker-entrypoint-initdb.d
networks:
- "standardnotes_standalone"
cache:
image: redis:6.0-alpine
container_name: 'standardnotes-cache'
restart: always
volumes:
- ./data/redis/:/data
#ports:
# - 6379
networks:
- "standardnotes_standalone"
networks:
standardnotes_standalone:
name: standardnotes_standalone
traefik:
external: true
.env
LOG_LEVEL=info
NODE_ENV=development
AUTH_JWT_SECRET=d47fa8c3561cb9db375f633e2f5367ca4ac0b1a26cb0485e2f60cb7914e8c797
EXPOSED_PORT=3000
DB_HOST=db
DB_REPLICA_HOST=db
DB_PORT=3306
DB_USERNAME=std_notes_user
DB_PASSWORD=0d306b2561f60b48ea8a9e3965772b1324a
DB_DATABASE=standard_notes_db
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
DB_MIGRATIONS_PATH=dist/migrations/*.js
REDIS_URL=redis://cache
SNS_TOPIC_ARN=
SNS_AWS_REGION=
SQS_QUEUE_URL=
SQS_AWS_REGION=
S3_AWS_REGION=
S3_BACKUP_BUCKET_NAME=
REDIS_EVENTS_CHANNEL=events
AUTH_SERVER_URL=http://auth:3000
EMAIL_ATTACHMENT_MAX_BYTE_SIZE=10485760
REVISIONS_FREQUENCY=300
# (Optional) New Relic Setup
NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME="Syncing Server JS"
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_NO_CONFIG_FILE=true
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
NEW_RELIC_LOG_ENABLED=false
NEW_RELIC_LOG_LEVEL=info
./docker/auth.env
LOG_LEVEL="info"
NODE_ENV="production"
AUTH_JWT_TTL=60000
JWT_SECRET=e10cf2cca668a693b51b678ae61f18a29931f8053e0da855d5620a1d1330f7b9
LEGACY_JWT_SECRET=29f30a54d2013494ba9da471946636318c887e47c01691fb8b89ecf50cef1a17
NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME=Auth
NEW_RELIC_NO_CONFIG_FILE=true
REDIS_EVENTS_CHANNEL="auth-events"
DISABLE_USER_REGISTRATION=false
PSEUDO_KEY_PARAMS_KEY=secret_key
ACCESS_TOKEN_AGE=5184000
REFRESH_TOKEN_AGE=31556926
MAX_LOGIN_ATTEMPTS=6
FAILED_LOGIN_LOCKOUT=3600
EPHEMERAL_SESSION_AGE=259200
# Must be a hex string exactly 32 bytes long
# e.g. feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
ENCRYPTION_SERVER_KEY=232f0349699d83e27f370ce7cf4b6337a456c5ef9145a09a5ad249813c3c8973
SYNCING_SERVER_URL=http://syncing-server-js:3000