diff --git a/docker-compose.yml b/docker-compose.yml index acaed05..a6e0980 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,6 @@ version: "3.8" services: syncstorage: - container_name: syncstorage-rs image: ghcr.io/porelli/firefox-sync:syncstorage-rs-mysql-latest environment: SYNC_HOST: 0.0.0.0 @@ -34,7 +33,6 @@ services: syncstorage_db: image: mariadb:lts - container_name: syncstorage-rs_db environment: MARIADB_RANDOM_ROOT_PASSWORD: "true" MARIADB_DATABASE: syncstorage @@ -54,7 +52,6 @@ services: tokenserver_db: image: mariadb:lts - container_name: firefox_tokenserver_db environment: MARIADB_RANDOM_ROOT_PASSWORD: "true" MARIADB_DATABASE: tokenserver @@ -73,7 +70,6 @@ services: restart: unless-stopped tokenserver_db_init: - container_name: firefox_tokenserver_db_init image: ghcr.io/porelli/firefox-sync:syncstorage-rs-mysql-latest depends_on: tokenserver_db: diff --git a/syncstorage-rs/db_init.sh b/syncstorage-rs/db_init.sh index 916e4a8..6529d92 100644 --- a/syncstorage-rs/db_init.sh +++ b/syncstorage-rs/db_init.sh @@ -2,11 +2,11 @@ IS_DONE=10; # adding service info -while [ $IS_DONE -gt 0 ]; do +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}';" | mariadb --host=firefox_tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE}; - RC=$?; + VALUES ('1', '1', '${DOMAIN}', '1', '0', '5', '0', '0') ON DUPLICATE KEY UPDATE node='${DOMAIN}';" | mariadb --host=tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE}; + RC=${?}; if [ $RC == 0 ] ; then IS_DONE=0; # setting users limit @@ -32,9 +32,9 @@ while [ $IS_DONE -gt 0 ]; do BEGIN CALL tokenserver.CheckUserLimit(); END // - DELIMITER ;" | mariadb --host=firefox_tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE}; + DELIMITER ;" | mariadb --host=tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE}; echo 'Database is correctly intialized!'; - current_users=`mariadb --host=firefox_tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE} -sN -e 'SELECT COUNT(*) FROM users;'` + current_users=`mariadb --host=tokenserver_db --user=${MARIADB_USER} --password=${MARIADB_PASSWORD} ${MARIADB_DATABASE} -sN -e 'SELECT COUNT(*) FROM users;'` echo "-----" echo "Current users: ${current_users}" echo "Max users: ${MAX_USERS}"