chore: update remaining config files to point to new db image
This commit is contained in:
parent
2d08375442
commit
9c40b9300a
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -125,7 +125,7 @@ jobs:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: ghcr.io/ietf-tools/datatracker-db-pg:latest
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -227,7 +227,7 @@ jobs:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: ghcr.io/ietf-tools/datatracker-db-pg:latest
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
3
.github/workflows/ci-run-tests.yml
vendored
3
.github/workflows/ci-run-tests.yml
vendored
|
@ -4,7 +4,6 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main'
|
||||||
- 'feat/postgres'
|
|
||||||
paths:
|
paths:
|
||||||
- 'client/**'
|
- 'client/**'
|
||||||
- 'ietf/**'
|
- 'ietf/**'
|
||||||
|
@ -20,7 +19,7 @@ jobs:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: ghcr.io/ietf-tools/datatracker-db-pg:latest
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
230
.github/workflows/dev-db-nightly.yml
vendored
230
.github/workflows/dev-db-nightly.yml
vendored
|
@ -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
|
|
|
@ -8,15 +8,11 @@ ALLOWED_HOSTS = ['*']
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'HOST': '__DBHOST__',
|
'HOST': '__DBHOST__',
|
||||||
'PORT': 3306,
|
'PORT': 5432,
|
||||||
'NAME': 'ietf_utf8',
|
'NAME': 'ietf',
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
'USER': 'django',
|
'USER': 'django',
|
||||||
'PASSWORD': 'RkTkDPFnKpko',
|
'PASSWORD': 'RkTkDPFnKpko',
|
||||||
'OPTIONS': {
|
|
||||||
'sql_mode': 'STRICT_TRANS_TABLES',
|
|
||||||
'init_command': 'SET storage_engine=InnoDB; SET names "utf8"',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ docker compose -p dtdebug cp ../../. app:/__w/datatracker/datatracker/
|
||||||
echo "Run prepare script..."
|
echo "Run prepare script..."
|
||||||
docker compose -p dtdebug exec app chmod +x ./dev/tests/prepare.sh
|
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 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 "================================================================="
|
||||||
echo "Launching zsh terminal:"
|
echo "Launching zsh terminal:"
|
||||||
docker compose -p dtdebug exec app /bin/zsh
|
docker compose -p dtdebug exec app /bin/zsh
|
||||||
|
|
|
@ -17,7 +17,7 @@ services:
|
||||||
GITHUB_ACTIONS: 'true'
|
GITHUB_ACTIONS: 'true'
|
||||||
HOME: /github/home
|
HOME: /github/home
|
||||||
db:
|
db:
|
||||||
image: ghcr.io/ietf-tools/datatracker-db-pg:latest
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- postgresdb-data:/var/lib/postgresql/data
|
- postgresdb-data:/var/lib/postgresql/data
|
||||||
|
|
|
@ -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"',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in a new issue