Skip to content

Commit 33f96f6

Browse files
committed
fix: docker compose configuration to use the new index container
1 parent d0134fc commit 33f96f6

File tree

10 files changed

+44
-18
lines changed

10 files changed

+44
-18
lines changed

bin/install.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ if ! [ -f "./.env" ]; then
77
fi
88

99
# Generate storage directory if it does not exist
10-
mkdir -p "./storage/database"
10+
mkdir -p "./storage/index/lib/database/"
11+
mkdir -p "./storage/tracker/lib/database/"
1112

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

1718
# Generate the sqlite database for the tracker if it does not exist

compose.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ services:
2727
volumes:
2828
- ./:/app
2929
depends_on:
30-
- idx-back
30+
- index
3131
- tracker
3232
- mailcatcher
3333
- mysql
3434

35-
idx-back:
35+
index:
3636
image: torrust/index-backend:develop
37-
user: ${TORRUST_IDX_BACK_USER_UID:-1000}:${TORRUST_IDX_BACK_USER_UID:-1000}
3837
tty: true
3938
environment:
40-
- TORRUST_IDX_BACK_CONFIG=${TORRUST_IDX_BACK_CONFIG}
41-
- TORRUST_IDX_BACK_CORS_PERMISSIVE=true
42-
- CARGO_HOME=/home/appuser/.cargo
39+
- TORRUST_INDEX_CONFIG=${TORRUST_INDEX_CONFIG}
40+
- TORRUST_INDEX_DATABASE_DRIVER=${TORRUST_TRACKER_DATABASE_DRIVER:-sqlite3}
41+
- TORRUST_INDEX_BACK_CORS_PERMISSIVE=${TORRUST_INDEX_BACK_CORS_PERMISSIVE:-true}
42+
- TORRUST_INDEX_TRACKER_API_TOKEN=${TORRUST_INDEX_TRACKER_API_TOKEN:-MyAccessToken}
4343
networks:
4444
- server_side
4545
ports:
@@ -56,7 +56,9 @@ services:
5656
# start_period: 10s
5757
# timeout: 3s
5858
volumes:
59-
- ./storage:/app/storage
59+
- ./storage/index/lib:/var/lib/torrust/index:Z
60+
- ./storage/index/log:/var/log/torrust/index:Z
61+
- ./storage/index/etc:/etc/torrust/index:Z
6062
depends_on:
6163
- tracker
6264
- mailcatcher

config-idx-back.local.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ max_password_length = 64
2020
secret_key = "MaxVerstappenWC2021"
2121

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

2626
[mail]
2727
email_verification_enabled = false

config-tracker.local.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
log_level = "info"
22
mode = "public"
33
db_driver = "Sqlite3"
4-
db_path = "/var/lib/torrust/tracker/database/torrust_tracker_e2e_testing.db"
4+
db_path = "/var/lib/torrust/tracker/database/e2e_testing_sqlite3.db"
55
announce_interval = 120
66
min_announce_interval = 120
77
max_peer_timeout = 900

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ export default defineConfig({
3737
}
3838
},
3939
env: {
40-
db_file_path: "./storage/database/torrust_index_backend_e2e_testing.db"
40+
db_file_path: "./storage/index/lib/database/e2e_testing_sqlite3.db"
4141
}
4242
});

docker/bin/e2e-env-down.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
4-
TORRUST_IDX_BACK_CONFIG=$(cat config-idx-back.local.toml) \
4+
TORRUST_INDEX_CONFIG=$(cat config-idx-back.local.toml) \
55
TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \
66
TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-sqlite3} \
77
TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken} \

docker/bin/e2e-env-install.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Generate the .env file if it does not exist
4+
if ! [ -f "./.env" ]; then
5+
# Copy .env file from development template
6+
cp dot.env.local .env
7+
fi
8+
9+
# Generate storage directory if it does not exist
10+
mkdir -p "./storage/index/lib/database/"
11+
mkdir -p "./storage/tracker/lib/database/"
12+
13+
# Generate the sqlite database for the index backend if it does not exist
14+
if ! [ -f "./storage/index/lib/database/e2e_testing_sqlite3.db" ]; then
15+
sqlite3 ./storage/index/lib/database/e2e_testing_sqlite3.db "VACUUM;"
16+
fi
17+
18+
# Generate the sqlite database for the tracker if it does not exist
19+
if ! [ -f "./storage/tracker/lib/database/e2e_testing_sqlite3.db" ]; then
20+
sqlite3 ./storage/tracker/lib/database/e2e_testing_sqlite3.db "VACUUM;"
21+
fi
22+
23+
npm install

docker/bin/e2e-env-up.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
44
docker compose build
55

66
TORRUST_IDX_BACK_USER_UID=${TORRUST_IDX_BACK_USER_UID:-1000} \
7-
TORRUST_IDX_BACK_CONFIG=$(cat config-idx-back.local.toml) \
7+
TORRUST_INDEX_CONFIG=$(cat config-idx-back.local.toml) \
88
TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \
99
TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-sqlite3} \
1010
TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken} \

docker/bin/run-e2e-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ wait_for_container_to_be_healthy() {
3737
return 1
3838
}
3939

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

4242
# Start E2E testing environment
4343
./docker/bin/e2e-env-up.sh || exit 1

dot.env.local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ API_BASE_URL=http://localhost:3001/v1
55
DATABASE_URL=sqlite://storage/database/data.db?mode=rwc
66

77
# Docker compose
8-
TORRUST_IDX_BACK_CONFIG=
8+
TORRUST_INDEX_CONFIG=
99
TORRUST_IDX_BACK_USER_UID=1000
1010
TORRUST_TRACKER_CONFIG=
1111
TORRUST_TRACKER_USER_UID=1000

0 commit comments

Comments
 (0)