diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12dab6849..4eb9271b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,7 +125,7 @@ jobs: services: db: - image: ghcr.io/ietf-tools/datatracker-db-pg:latest + image: ghcr.io/ietf-tools/datatracker-db:latest steps: - uses: actions/checkout@v3 @@ -227,7 +227,7 @@ jobs: services: db: - image: ghcr.io/ietf-tools/datatracker-db-pg:latest + image: ghcr.io/ietf-tools/datatracker-db:latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/ci-run-tests.yml b/.github/workflows/ci-run-tests.yml index 4185b5858..09693af83 100644 --- a/.github/workflows/ci-run-tests.yml +++ b/.github/workflows/ci-run-tests.yml @@ -4,7 +4,6 @@ on: pull_request: branches: - 'main' - - 'feat/postgres' paths: - 'client/**' - 'ietf/**' @@ -20,7 +19,7 @@ jobs: services: db: - image: ghcr.io/ietf-tools/datatracker-db-pg:latest + image: ghcr.io/ietf-tools/datatracker-db:latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/dev-db-nightly.yml b/.github/workflows/dev-db-nightly.yml deleted file mode 100644 index 17853e522..000000000 --- a/.github/workflows/dev-db-nightly.yml +++ /dev/null @@ -1,230 +0,0 @@ -# GITHUB ACTIONS - WORKFLOW - -# Build the database dev docker image with the latest database dump every night -# so that developers don't have to manually build it themselves. - -# DB dump becomes available at around 0700 UTC, so schedule is set to 0800 UTC -# to account for variations. - -name: Nightly Dev DB Image - -# Controls when the workflow will run -on: - # Run every night - # schedule: - # - cron: '0 8 * * *' - - # Run on db.Dockerfile changes - # push: - # branches: - # - main - # paths: - # - 'docker/db.Dockerfile' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - inputs: - skipMariaDBBuild: - description: 'Skip MariaDB Build' - default: false - required: true - type: boolean - exportDumpAsSQL: - description: 'Save PostgreSQL Debug Dump' - default: false - required: true - type: boolean - -jobs: - build-mariadb: - name: Build MariaDB Docker Images - runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || github.event.inputs.skipMariaDBBuild == 'false') }} - permissions: - contents: read - packages: write - strategy: - matrix: - include: - - platform: "linux/arm64" - docker: "arm64" - - platform: "linux/amd64" - docker: "x64" - steps: - - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker Build & Push - uses: docker/build-push-action@v4 - with: - context: . - file: docker/db.Dockerfile - platforms: ${{ matrix.platform }} - push: true - tags: ghcr.io/ietf-tools/datatracker-db:latest-${{ matrix.docker }} - provenance: false - - combine-mariadb: - name: Create MariaDB Docker Manifests - runs-on: ubuntu-latest - needs: [build-mariadb] - permissions: - packages: write - steps: - - name: Get Current Date as Tag - id: date - run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create and Push Manifests - run: | - echo "Creating the manifests..." - docker manifest create ghcr.io/ietf-tools/datatracker-db:nightly-${{ steps.date.outputs.date }} ghcr.io/ietf-tools/datatracker-db:latest-x64 ghcr.io/ietf-tools/datatracker-db:latest-arm64 - docker manifest create ghcr.io/ietf-tools/datatracker-db:latest ghcr.io/ietf-tools/datatracker-db:latest-x64 ghcr.io/ietf-tools/datatracker-db:latest-arm64 - echo "Pushing the manifests..." - docker manifest push -p ghcr.io/ietf-tools/datatracker-db:nightly-${{ steps.date.outputs.date }} - docker manifest push -p ghcr.io/ietf-tools/datatracker-db:latest - - migrate: - name: Migrate MySQL to PostgreSQL DB - runs-on: ubuntu-latest - container: ghcr.io/ietf-tools/datatracker-app-base:latest - if: ${{ always() && !failure() }} - needs: [combine-mariadb] - permissions: - contents: read - packages: write - services: - db: - image: ghcr.io/ietf-tools/datatracker-db:latest - volumes: - - mariadb-data:/var/lib/mysql - env: - MYSQL_ROOT_PASSWORD: ietf - MYSQL_DATABASE: ietf_utf8 - MYSQL_USER: django - MYSQL_PASSWORD: RkTkDPFnKpko - pgdb: - image: postgres:14.5 - volumes: - - /pgdata:/var/lib/postgresql/data - env: - POSTGRES_PASSWORD: RkTkDPFnKpko - POSTGRES_USER: django - POSTGRES_DB: ietf - POSTGRES_HOST_AUTH_METHOD: trust - steps: - - uses: actions/checkout@v3 - with: - ref: 'feat/postgres' - - - name: Migrate - uses: nick-fields/retry@v2 - with: - timeout_minutes: 30 - max_attempts: 3 - command: | - chmod +x ./docker/scripts/db-pg-migrate.sh - sh ./docker/scripts/db-pg-migrate.sh - on_retry_command: | - psql -U django -h pgdb -d ietf -v ON_ERROR_STOP=1 -c '\x' -c 'DROP SCHEMA ietf_utf8 CASCADE;' - rm -f cast.load - - - name: Upload DB Dump - uses: actions/upload-artifact@v3 - with: - name: dump - path: ietf.dump - - - name: Export as SQL (Debug) - if: ${{ github.event.inputs.exportDumpAsSQL == 'true' }} - run: pg_dump -h pgdb -U django ietf > ietf.sql - - - name: Upload SQL DB Dump (Debug) - if: ${{ github.event.inputs.exportDumpAsSQL == 'true' }} - uses: actions/upload-artifact@v3 - with: - name: dumpsql - path: ietf.sql - - build: - name: Build PostgreSQL Docker Images - runs-on: ubuntu-latest - if: ${{ always() && !failure() }} - needs: [migrate] - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v3 - with: - ref: 'feat/postgres' - - - name: Download DB Dump - uses: actions/download-artifact@v3 - with: - name: dump - - - name: Get Current Date as Tag - id: date - run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker Build & Push - uses: docker/build-push-action@v4 - with: - context: . - file: docker/db-pg.Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ghcr.io/ietf-tools/datatracker-db-pg:latest,ghcr.io/ietf-tools/datatracker-db-pg:nightly-${{ steps.date.outputs.date }} - provenance: false - - cleanup: - name: Remove Old Images - runs-on: ubuntu-latest - if: ${{ always() && !failure() }} - needs: [build] - permissions: - packages: write - steps: - - uses: actions/checkout@v3 - - - name: Delete Old Versions - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd dev/del-old-packages - npm install - node index diff --git a/dev/diff/settings_local.py b/dev/diff/settings_local.py index 0a89f5c8e..db92055ed 100644 --- a/dev/diff/settings_local.py +++ b/dev/diff/settings_local.py @@ -8,15 +8,11 @@ ALLOWED_HOSTS = ['*'] DATABASES = { 'default': { 'HOST': '__DBHOST__', - 'PORT': 3306, - 'NAME': 'ietf_utf8', - 'ENGINE': 'django.db.backends.mysql', + 'PORT': 5432, + 'NAME': 'ietf', + 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'django', 'PASSWORD': 'RkTkDPFnKpko', - 'OPTIONS': { - 'sql_mode': 'STRICT_TRANS_TABLES', - 'init_command': 'SET storage_engine=InnoDB; SET names "utf8"', - }, }, } diff --git a/dev/tests/debug.sh b/dev/tests/debug.sh index 37e7bc3ab..405daae37 100644 --- a/dev/tests/debug.sh +++ b/dev/tests/debug.sh @@ -18,7 +18,7 @@ docker compose -p dtdebug cp ../../. app:/__w/datatracker/datatracker/ echo "Run prepare script..." docker compose -p dtdebug exec app chmod +x ./dev/tests/prepare.sh docker compose -p dtdebug exec app sh ./dev/tests/prepare.sh -docker compose -p dtdebug exec app /usr/local/bin/wait-for db:3306 -- echo "DB ready" +docker compose -p dtdebug exec app /usr/local/bin/wait-for db:5432 -- echo "DB ready" echo "=================================================================" echo "Launching zsh terminal:" docker compose -p dtdebug exec app /bin/zsh diff --git a/dev/tests/docker-compose.debug.yml b/dev/tests/docker-compose.debug.yml index ee226ede9..74491a5b2 100644 --- a/dev/tests/docker-compose.debug.yml +++ b/dev/tests/docker-compose.debug.yml @@ -17,7 +17,7 @@ services: GITHUB_ACTIONS: 'true' HOME: /github/home db: - image: ghcr.io/ietf-tools/datatracker-db-pg:latest + image: ghcr.io/ietf-tools/datatracker-db:latest restart: unless-stopped volumes: - postgresdb-data:/var/lib/postgresql/data diff --git a/docker/configs/settings_mysqldb.py b/docker/configs/settings_mysqldb.py deleted file mode 100644 index ee2336846..000000000 --- a/docker/configs/settings_mysqldb.py +++ /dev/null @@ -1,14 +0,0 @@ -DATABASES = { - 'default': { - 'HOST': 'db', - 'PORT': 3306, - 'NAME': 'ietf_utf8', - 'ENGINE': 'django.db.backends.mysql', - 'USER': 'django', - 'PASSWORD': 'RkTkDPFnKpko', - 'OPTIONS': { - 'sql_mode': 'STRICT_TRANS_TABLES', - 'init_command': 'SET storage_engine=InnoDB; SET names "utf8"', - }, - }, -}