Skip to content

Commit

Permalink
feat(compose) use service names
Browse files Browse the repository at this point in the history
  • Loading branch information
porelli committed Nov 26, 2024
1 parent 0eaee27 commit 84f06fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -34,7 +33,6 @@ services:

syncstorage_db:
image: mariadb:lts
container_name: syncstorage-rs_db
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "true"
MARIADB_DATABASE: syncstorage
Expand All @@ -54,7 +52,6 @@ services:

tokenserver_db:
image: mariadb:lts
container_name: firefox_tokenserver_db
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "true"
MARIADB_DATABASE: tokenserver
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions syncstorage-rs/db_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down

0 comments on commit 84f06fc

Please sign in to comment.