Skip to content

Commit 551b89e

Browse files
committed
Merge #367: Fix container configuration
db968d5 ci: [#363] fix container configuration (Jose Celano) Pull request description: Following latest cahgnes in the Tracker and Index. ACKs for top commit: josecelano: ACK db968d5 Tree-SHA512: 4cc437e9216aa42415fea6f3e6760f2dfcbf6227cbd7717083cf8f1e73106f4e6205b56378da586e8e02514366a64fb1d075621942e4b89e361bd2f60cb1db67
2 parents 8b816ee + db968d5 commit 551b89e

30 files changed

+453
-185
lines changed

.env.local

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# App build variables
2+
API_BASE_URL=http://localhost:3001/v1
3+
4+
# Rust SQLx
5+
DATABASE_URL=sqlite://storage/database/data.db?mode=rwc
6+
7+
# Docker compose
8+
TORRUST_INDEX_CONFIG=
9+
USER_ID=1000
10+
TORRUST_TRACKER_CONFIG=
11+
TORRUST_TRACKER_USER_UID=1000
12+
TORRUST_TRACKER_API_TOKEN=MyAccessToken

.github/workflows/test_docker_build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ jobs:
1717
uses: docker/build-push-action@v5
1818
with:
1919
context: .
20-
file: ./Dockerfile
20+
file: ./Containerfile
2121
push: false
2222
cache-from: type=gha
2323
cache-to: type=gha,mode=max
2424

25-
# todo: enable when docker compose congiguration is ready
26-
#- name: Build docker-compose images
27-
# run: docker compose build
25+
- id: checkout
26+
name: Checkout Repository
27+
uses: actions/checkout@v4
28+
29+
- id: compose
30+
name: Compose
31+
run: docker compose build
32+

.github/workflows/test.yml renamed to .github/workflows/testing.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ jobs:
2424
run: npm run generate
2525

2626
- name: E2E Tests
27-
run: ./docker/bin/run-e2e-tests.sh
28-
27+
run: ./contrib/dev-tools/container/e2e/sqlite/run-e2e-tests.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.cache
22
.env
33
.env*
4+
!.env.local
45
.idea
56
.nitro
67
.nuxt
File renamed without changes.

compose.yaml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: torrust
22
services:
33

4-
idx-fron:
4+
index-gui:
55
build:
66
context: .
7+
dockerfile: ./Containerfile
78
args:
89
RUN_AS_USER: appuser
910
UID: ${TORRUST_INDEX_GUI_USER_UID:-1001}
@@ -13,17 +14,6 @@ services:
1314
ports:
1415
- 3000:3000
1516
- 24678:24678
16-
# todo: implement healthcheck
17-
#healthcheck:
18-
# test:
19-
# [
20-
# "CMD-SHELL",
21-
# ""
22-
# ]
23-
# interval: 10s
24-
# retries: 5
25-
# start_period: 10s
26-
# timeout: 3s
2717
volumes:
2818
- ./:/app
2919
depends_on:
@@ -36,25 +26,16 @@ services:
3626
image: torrust/index:develop
3727
tty: true
3828
environment:
29+
- USER_ID=${USER_ID}
3930
- TORRUST_INDEX_CONFIG=${TORRUST_INDEX_CONFIG}
40-
- TORRUST_INDEX_DATABASE_DRIVER=${TORRUST_TRACKER_DATABASE_DRIVER:-sqlite3}
41-
- TORRUST_INDEX_API_CORS_PERMISSIVE=${TORRUST_INDEX_API_CORS_PERMISSIVE:-true}
31+
- TORRUST_INDEX_DATABASE=${TORRUST_INDEX_DATABASE:-e2e_testing_sqlite3}
32+
- TORRUST_INDEX_DATABASE_DRIVER=${TORRUST_INDEX_DATABASE_DRIVER:-sqlite3}
4233
- TORRUST_INDEX_TRACKER_API_TOKEN=${TORRUST_INDEX_TRACKER_API_TOKEN:-MyAccessToken}
34+
- TORRUST_INDEX_API_CORS_PERMISSIVE=${TORRUST_INDEX_API_CORS_PERMISSIVE:-true}
4335
networks:
4436
- server_side
4537
ports:
4638
- 3001:3001
47-
# todo: implement healthcheck
48-
#healthcheck:
49-
# test:
50-
# [
51-
# "CMD-SHELL",
52-
# "cargo run healthcheck"
53-
# ]
54-
# interval: 10s
55-
# retries: 5
56-
# start_period: 10s
57-
# timeout: 3s
5839
volumes:
5940
- ./storage/index/lib:/var/lib/torrust/index:Z
6041
- ./storage/index/log:/var/log/torrust/index:Z
@@ -68,8 +49,10 @@ services:
6849
image: torrust/tracker:develop
6950
tty: true
7051
environment:
52+
- USER_ID=${USER_ID}
7153
- TORRUST_TRACKER_CONFIG=${TORRUST_TRACKER_CONFIG}
72-
- TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-sqlite3}
54+
- TORRUST_TRACKER_DATABASE=${TORRUST_TRACKER_DATABASE:-e2e_testing_sqlite3}
55+
- TORRUST_TRACKER_DATABASE_DRIVER=${TORRUST_TRACKER_DATABASE_DRIVER:-sqlite3}
7356
- TORRUST_TRACKER_API_ADMIN_TOKEN=${TORRUST_TRACKER_API_ADMIN_TOKEN:-MyAccessToken}
7457
networks:
7558
- server_side

docker/bin/build.sh renamed to contrib/dev-tools/container/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ docker build \
1313
--build-arg UID="$TORRUST_INDEX_GUI_USER_UID" \
1414
--build-arg RUN_AS_USER="$TORRUST_INDEX_GUI_RUN_AS_USER" \
1515
--build-arg API_BASE_URL="$TORRUST_INDEX_GUI_API_BASE_URL" \
16-
-t torrust-index-frontend .
16+
-t torrust-index-gui .
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
USER_ID=${USER_ID:-1000} \
4+
TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.e2e.container.sqlite3.toml) \
5+
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
6+
docker compose down
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.e2e.container.sqlite3.toml) \
4+
docker compose build
5+
6+
USER_ID=${USER_ID:-1000} \
7+
TORRUST_INDEX_CONFIG=$(cat ./share/default/config/index.e2e.container.sqlite3.toml) \
8+
TORRUST_INDEX_DATABASE="e2e_testing_sqlite3" \
9+
TORRUST_INDEX_DATABASE_DRIVER="sqlite3" \
10+
TORRUST_INDEX_TRACKER_API_TOKEN="MyAccessToken" \
11+
TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.e2e.container.sqlite3.toml) \
12+
TORRUST_TRACKER_DATABASE="e2e_testing_sqlite3" \
13+
TORRUST_TRACKER_DATABASE_DRIVER="sqlite3" \
14+
TORRUST_TRACKER_API_ADMIN_TOKEN="MyAccessToken" \
15+
docker compose up --detach --pull always --remove-orphans
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# This script is only intended to be used for E2E testing environment.
4+
5+
## Index
6+
7+
# Generate the Index sqlite database directory and file if it does not exist
8+
mkdir -p ./storage/index/lib/database
9+
10+
if ! [ -f "./storage/index/lib/database/${TORRUST_INDEX_DATABASE}.db" ]; then
11+
echo "Creating index database '${TORRUST_INDEX_DATABASE}.db'"
12+
sqlite3 "./storage/index/lib/database/${TORRUST_INDEX_DATABASE}.db" "VACUUM;"
13+
fi
14+
15+
## Tracker
16+
17+
# Generate the Tracker sqlite database directory and file if it does not exist
18+
mkdir -p ./storage/tracker/lib/database
19+
20+
if ! [ -f "./storage/tracker/lib/database/${TORRUST_TRACKER_DATABASE}.db" ]; then
21+
echo "Creating tracker database '${TORRUST_TRACKER_DATABASE}.db'"
22+
sqlite3 "./storage/tracker/lib/database/${TORRUST_TRACKER_DATABASE}.db" "VACUUM;"
23+
fi

0 commit comments

Comments
 (0)