From 16bf5a09be7f09c76587816672086c5693eb6b4f Mon Sep 17 00:00:00 2001 From: Cameron Garnham Date: Fri, 25 Aug 2023 23:39:29 +0200 Subject: [PATCH] dev: more work --- .github/workflows/container.yaml | 15 ++++----------- compose.yaml | 5 ++--- config-index.sqlite.local.toml | 2 +- config-tracker.local.toml | 2 +- docker/bin/build.sh | 13 ++----------- docker/bin/e2e/mysql/e2e-env-up.sh | 17 ++++++++--------- docker/bin/e2e/sqlite/e2e-env-up.sh | 16 ++++++++-------- docker/bin/run.sh | 7 +++---- 8 files changed, 29 insertions(+), 48 deletions(-) diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml index ee562f55..0648698d 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/container.yaml @@ -35,16 +35,9 @@ jobs: steps: - id: checkout_index - name: Checkout Repository (Index) + name: Checkout Repository (index) uses: actions/checkout@v3 - - id: checkout_tracker - name: Checkout Repository (Tracker) - uses: actions/checkout@v3 - with: - repository: torrust/torrust-tracker - path: tracker - - id: setup name: Setup Toolchain uses: docker/setup-buildx-action@v2 @@ -65,7 +58,7 @@ jobs: name: Build (tracker) uses: docker/build-push-action@v4 with: - context: tracker + context: https://github.com/torrust/torrust-tracker.git#pull/363/head push: false load: true target: debug @@ -89,8 +82,8 @@ jobs: name: Run Applications run: | - export TORRUST_INDEX_CONFIG=$(cat index/config-index.mysql.local.toml) - export TORRUST_TRACKER_CONFIG=$(cat index/config-tracker.local.toml) + export TORRUST_INDEX_CONFIG=$(cat config-index.mysql.local.toml) + export TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) docker compose up --detach diff --git a/compose.yaml b/compose.yaml index 2bb40bb0..b3ff293d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -8,13 +8,12 @@ services: environment: - TORRUST_INDEX_CONFIG=${TORRUST_INDEX_CONFIG} - TORRUST_INDEX_CORS_PERMISSIVE=true - - CARGO_HOME=/home/appuser/.cargo networks: - server_side ports: - 3001:3001 volumes: - - ./lib/torrust:/var/lib/torrust + - ./storage:/var/lib/torrust/index depends_on: - tracker - mailcatcher @@ -33,7 +32,7 @@ services: - 6969:6969/udp - 1212:1212/tcp volumes: - - ./lib/torrust:/var/lib/torrust + - ./storage:/var/lib/torrust/tracker depends_on: - mysql diff --git a/config-index.sqlite.local.toml b/config-index.sqlite.local.toml index 94cdc2f6..24236586 100644 --- a/config-index.sqlite.local.toml +++ b/config-index.sqlite.local.toml @@ -20,7 +20,7 @@ max_password_length = 64 secret_key = "MaxVerstappenWC2021" [database] -connect_url = "sqlite:///var/lib/torrust/database/torrust_index_backend_e2e_testing.db?mode=rwc" +connect_url = "sqlite:///var/lib/torrust/index/database/torrust_index_backend_e2e_testing.db?mode=rwc" [mail] email_verification_enabled = false diff --git a/config-tracker.local.toml b/config-tracker.local.toml index 0e621435..2c7cb704 100644 --- a/config-tracker.local.toml +++ b/config-tracker.local.toml @@ -1,7 +1,7 @@ log_level = "info" mode = "public" db_driver = "Sqlite3" -db_path = "/var/lib/torrust/database/torrust_tracker_e2e_testing.db" +db_path = "/var/lib/torrust/tracker/database/torrust_tracker_e2e_testing.db" announce_interval = 120 min_announce_interval = 120 max_peer_timeout = 900 diff --git a/docker/bin/build.sh b/docker/bin/build.sh index 29d6c264..ea616e50 100755 --- a/docker/bin/build.sh +++ b/docker/bin/build.sh @@ -1,13 +1,4 @@ #!/bin/bash -TORRUST_INDEX_USER_UID=${TORRUST_INDEX_USER_UID:-1000} -TORRUST_IDX_BACK_RUN_AS_USER=${TORRUST_IDX_BACK_RUN_AS_USER:-appuser} - -echo "Building docker image ..." -echo "TORRUST_INDEX_USER_UID: $TORRUST_INDEX_USER_UID" -echo "TORRUST_IDX_BACK_RUN_AS_USER: $TORRUST_IDX_BACK_RUN_AS_USER" - -docker build \ - --build-arg UID="$TORRUST_INDEX_USER_UID" \ - --build-arg RUN_AS_USER="$TORRUST_IDX_BACK_RUN_AS_USER" \ - --target debug --tag torrust-index-backend:debug . +docker build --target debug --tag torrust-index-backend:debug . +docker build --target debug --tag torrust-tracker:debug https://github.com/torrust/torrust-tracker.git#pull/363/head diff --git a/docker/bin/e2e/mysql/e2e-env-up.sh b/docker/bin/e2e/mysql/e2e-env-up.sh index 17f0cf40..b6aa36d4 100755 --- a/docker/bin/e2e/mysql/e2e-env-up.sh +++ b/docker/bin/e2e/mysql/e2e-env-up.sh @@ -1,12 +1,11 @@ #!/bin/bash -USER_UID=${USER_UID:-1000} \ - docker compose build - -USER_UID=${USER_UID:-1000} \ - TORRUST_INDEX_CONFIG=$(cat config-index.mysql.local.toml) \ - TORRUST_INDEX_MYSQL_DATABASE="torrust_index_backend_e2e_testing" \ - TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \ - TORRUST_TRACKER_API_TOKEN=${TORRUST_TRACKER_API_TOKEN:-MyAccessToken} \ - docker compose up -d +docker compose build + + +TORRUST_INDEX_CONFIG=$(cat config-index.mysql.local.toml) \ +TORRUST_INDEX_MYSQL_DATABASE="torrust_index_backend_e2e_testing" \ +TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \ +TORRUST_TRACKER_API_TOKEN=${TORRUST_TRACKER_API_TOKEN:-MyAccessToken} \ +docker compose up -d diff --git a/docker/bin/e2e/sqlite/e2e-env-up.sh b/docker/bin/e2e/sqlite/e2e-env-up.sh index b81c73db..8df5dc95 100755 --- a/docker/bin/e2e/sqlite/e2e-env-up.sh +++ b/docker/bin/e2e/sqlite/e2e-env-up.sh @@ -1,10 +1,10 @@ #!/bin/bash -USER_UID=${USER_UID:-1000} \ - docker compose build - -USER_UID=${USER_UID:-1000} \ - TORRUST_INDEX_CONFIG=$(cat config-index.sqlite.local.toml) \ - TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \ - TORRUST_TRACKER_API_TOKEN=${TORRUST_TRACKER_API_TOKEN:-MyAccessToken} \ - docker compose up -d + +docker compose build + + +TORRUST_INDEX_CONFIG=$(cat config-index.sqlite.local.toml) \ +TORRUST_TRACKER_CONFIG=$(cat config-tracker.local.toml) \ +TORRUST_TRACKER_API_TOKEN=${TORRUST_TRACKER_API_TOKEN:-MyAccessToken} \ +docker compose up -d diff --git a/docker/bin/run.sh b/docker/bin/run.sh index 8aeaeec6..fc8e50dc 100755 --- a/docker/bin/run.sh +++ b/docker/bin/run.sh @@ -1,11 +1,10 @@ #!/bin/bash -TORRUST_INDEX_USER_UID=${TORRUST_INDEX_USER_UID:-1000} TORRUST_INDEX_CONFIG=$(cat config.toml) docker run -it \ - --user="$TORRUST_INDEX_USER_UID" \ --publish 3001:3001/tcp \ --env TORRUST_INDEX_CONFIG="$TORRUST_INDEX_CONFIG" \ - --volume "$(pwd)/lib/torrust":"/var/lib/torrust" \ - torrust-index-backend + --volume "$(pwd)/source":"/var/lib/torrust" \ + --entrypoint "torrust-index-backend" \ + torrust-index-backend:debug