Skip to content

Commit

Permalink
Create docker-compose.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jeena committed Sep 22, 2023
1 parent 7969cc2 commit ea49e33
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions docker-compose.yaml
@@ -0,0 +1,91 @@
version: '3.8'

services:
syncstorage:
container_name: firefox_syncstorage
image: mozilla/syncstorage-rs:0.13.6
environment:
SYNC_HOST: 0.0.0.0
SYNC_HUMAN_LOGS: 1
SYNC_MASTER_SECRET: ${SYNC_MASTER_SECRET}
SYNC_SYNCSTORAGE__DATABASE_URL: mysql://${MARIADB_USER}:${MARIADB_PASSWORD}@syncstorage_db:3306/syncstorage
SYNC_TOKENSERVER__ENABLED: "true"
SYNC_TOKENSERVER__RUN_MIGRATIONS: "true"
SYNC_TOKENSERVER__NODE_TYPE: mysql
SYNC_TOKENSERVER__DATABASE_URL: mysql://${MARIADB_USER}:${MARIADB_PASSWORD}@tokenserver_db:3306/tokenserver
SYNC_TOKENSERVER__FXA_EMAIL_DOMAIN: api.accounts.firefox.com
SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL: https://oauth.accounts.firefox.com/v1
SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET: ${METRICS_HASH_SECRET}
SYNC_TOKENSERVER__ADDITIONAL_BLOCKING_THREADS_FOR_FXA_REQUESTS: 2
RUST_LOG: info
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/__heartbeat__"]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
depends_on:
- syncstorage_db
- tokenserver_db
ports:
- 5000:8000

syncstorage_db:
image: mariadb:10.11
container_name: firefox_syncstorage_db
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "true"
MARIADB_DATABASE: syncstorage
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
MARIADB_AUTO_UPGRADE: "true"
volumes:
- syncstorage-db:/var/lib/mysql
restart: unless-stopped

tokenserver_db:
image: mariadb:10.11
container_name: firefox_tokenserver_db
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "true"
MARIADB_DATABASE: tokenserver
MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD}
MARIADB_AUTO_UPGRADE: "true"
volumes:
- tokenserver-db:/var/lib/mysql
restart: unless-stopped

tokenserver_db_init:
container_name: firefox_tokenserver_db_init
image: mariadb:10.11
depends_on:
- tokenserver_db
- syncstorage
restart: "no"
entrypoint:
bash -c "
IS_DONE=10;
while [ $$IS_DONE -gt 0 ]; do
echo \"INSERT IGNORE INTO services (id, service, pattern) VALUES ('1', 'sync-1.5', '{node}/1.5/{uid}');
INSERT INTO nodes (id, service, node, available, current_load, capacity, downed, backoff)
VALUES ('1', '1', '${DOMAIN}', '1', '0', '5', '0', '0') ON DUPLICATE KEY UPDATE node='${DOMAIN}';\"|mysql --host=firefox_tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} tokenserver;
RC=$$?;
echo \"mysql return code was $$RC\";
if [ $$RC == 0 ] ; then
IS_DONE=0;
echo 'Done!';
exit 0;
else
echo 'Waiting for tables...';
sleep 5;
((IS_DONE--));
fi;
done;
echo 'Giving up, sorry';
exit 42;
"
volumes:
syncstorage-db:
tokenserver-db:

0 comments on commit ea49e33

Please sign in to comment.