Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker compose configuration to use the new index container #320

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ if ! [ -f "./.env" ]; then
fi

# Generate storage directory if it does not exist
mkdir -p "./storage/database"
mkdir -p "./storage/index/lib/database/"
mkdir -p "./storage/tracker/lib/database/"

# Generate the sqlite database for the index backend if it does not exist
if ! [ -f "./storage/database/data.db" ]; then
sqlite3 ./storage/database/data.db "VACUUM;"
if ! [ -f "./storage/index/lib/database/sqlite3.db" ]; then
sqlite3 ./storage/index/lib/database/sqlite3.db "VACUUM;"
fi

# Generate the sqlite database for the tracker if it does not exist
Expand Down
16 changes: 9 additions & 7 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ services:
volumes:
- ./:/app
depends_on:
- idx-back
- index
- tracker
- mailcatcher
- mysql

idx-back:
index:
image: torrust/index-backend:develop
user: ${TORRUST_IDX_BACK_USER_UID:-1000}:${TORRUST_IDX_BACK_USER_UID:-1000}
tty: true
environment:
- TORRUST_IDX_BACK_CONFIG=${TORRUST_IDX_BACK_CONFIG}
- TORRUST_IDX_BACK_CORS_PERMISSIVE=true
- CARGO_HOME=/home/appuser/.cargo
- TORRUST_INDEX_CONFIG=${TORRUST_INDEX_CONFIG}
- TORRUST_INDEX_DATABASE_DRIVER=${TORRUST_TRACKER_DATABASE_DRIVER:-sqlite3}
- TORRUST_INDEX_BACK_CORS_PERMISSIVE=${TORRUST_INDEX_BACK_CORS_PERMISSIVE:-true}
- TORRUST_INDEX_TRACKER_API_TOKEN=${TORRUST_INDEX_TRACKER_API_TOKEN:-MyAccessToken}
networks:
- server_side
ports:
Expand All @@ -56,7 +56,9 @@ services:
# start_period: 10s
# timeout: 3s
volumes:
- ./storage:/app/storage
- ./storage/index/lib:/var/lib/torrust/index:Z
- ./storage/index/log:/var/log/torrust/index:Z
- ./storage/index/etc:/etc/torrust/index:Z
depends_on:
- tracker
- mailcatcher
Expand Down
4 changes: 2 additions & 2 deletions config-idx-back.local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ max_password_length = 64
secret_key = "MaxVerstappenWC2021"

[database]
connect_url = "sqlite://storage/database/torrust_index_backend_e2e_testing.db?mode=rwc" # SQLite
#connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index_backend_e2e_testing" # MySQL
connect_url = "sqlite:///var/lib/torrust/index/database/e2e_testing_sqlite3.db?mode=rwc" # SQLite
#connect_url = "mysql://root:root_secret_password@mysql:3306/torrust_index_e2e_testing" # MySQL

[mail]
email_verification_enabled = false
Expand Down
2 changes: 1 addition & 1 deletion config-tracker.local.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
log_level = "info"
mode = "public"
db_driver = "Sqlite3"
db_path = "/var/lib/torrust/tracker/database/torrust_tracker_e2e_testing.db"
db_path = "/var/lib/torrust/tracker/database/e2e_testing_sqlite3.db"
announce_interval = 120
min_announce_interval = 120
max_peer_timeout = 900
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ export default defineConfig({
}
},
env: {
db_file_path: "./storage/database/torrust_index_backend_e2e_testing.db"
db_file_path: "./storage/index/lib/database/e2e_testing_sqlite3.db"
}
});
2 changes: 1 addition & 1 deletion docker/bin/e2e-env-down.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
TORRUST_IDX_BACK_CONFIG=$(cat config-idx-back.local.toml) \
TORRUST_INDEX_CONFIG=$(cat config-idx-back.local.toml) \
TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \
TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-sqlite3} \
TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken} \
Expand Down
23 changes: 23 additions & 0 deletions docker/bin/e2e-env-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Generate the .env file if it does not exist
if ! [ -f "./.env" ]; then
# Copy .env file from development template
cp dot.env.local .env
fi

# Generate storage directory if it does not exist
mkdir -p "./storage/index/lib/database/"
mkdir -p "./storage/tracker/lib/database/"

# Generate the sqlite database for the index backend if it does not exist
if ! [ -f "./storage/index/lib/database/e2e_testing_sqlite3.db" ]; then
sqlite3 ./storage/index/lib/database/e2e_testing_sqlite3.db "VACUUM;"
fi

# Generate the sqlite database for the tracker if it does not exist
if ! [ -f "./storage/tracker/lib/database/e2e_testing_sqlite3.db" ]; then
sqlite3 ./storage/tracker/lib/database/e2e_testing_sqlite3.db "VACUUM;"
fi

npm install
2 changes: 1 addition & 1 deletion docker/bin/e2e-env-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
docker compose build

TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
TORRUST_IDX_BACK_CONFIG=$(cat config-idx-back.local.toml) \
TORRUST_INDEX_CONFIG=$(cat config-idx-back.local.toml) \
TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \
TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-sqlite3} \
TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken} \
Expand Down
2 changes: 1 addition & 1 deletion docker/bin/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ wait_for_container_to_be_healthy() {
return 1
}

./bin/install.sh || exit 1
./docker/bin/e2e-env-install.sh || exit 1

# Start E2E testing environment
./docker/bin/e2e-env-up.sh || exit 1
Expand Down
2 changes: 1 addition & 1 deletion dot.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ API_BASE_URL=http://localhost:3001/v1
DATABASE_URL=sqlite://storage/database/data.db?mode=rwc

# Docker compose
TORRUST_IDX_BACK_CONFIG=
TORRUST_INDEX_CONFIG=
TORRUST_IDX_BACK_USER_UID=1000
TORRUST_TRACKER_CONFIG=
TORRUST_TRACKER_USER_UID=1000
Expand Down