From 65795792e2f8f70e5c93202359cd69474fc5aebb Mon Sep 17 00:00:00 2001 From: Jim Laney Date: Mon, 16 Oct 2023 16:20:45 -0700 Subject: [PATCH 1/2] add postgres libs and settings --- .dockerignore | 49 ++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 21 +++++++----------- docker/prod-values.yml | 19 +++++++--------- docker/test-values.yml | 19 +++++++--------- 4 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4e59dbd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,49 @@ +*.pyc +*.pyo +*.mo +*.db +*.css.map +*.egg +*.egg-info +*.sql.gz + +.cache +.project +.idea +.pydevproject +.DS_Store +.Python +.git/ +.bin/ +.installed.cfg +.venv +.env.sample + +Dockerfile* +docker-compose* +node_modules +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +logs/ +pyvenv.cfg +pip-selfcheck.json +get-pip.py +db.sqlite3 + +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts + +docker/*-values.yml diff --git a/Dockerfile b/Dockerfile index 278ba44..b3be571 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,18 @@ ARG DJANGO_CONTAINER_VERSION=1.4.1 -FROM gcr.io/uwit-mci-axdd/django-container:${DJANGO_CONTAINER_VERSION} as app-container +FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-container:${DJANGO_CONTAINER_VERSION} as app-container USER root -RUN apt-get update && apt-get install mysql-client libmysqlclient-dev -y +RUN apt-get update && apt-get install libpq-dev -y USER acait -ADD --chown=acait:acait setup.py /app/ -ADD --chown=acait:acait requirements.txt /app/ -ADD --chown=acait:acait README.md /app/ - -RUN . /app/bin/activate && pip install -r requirements.txt -RUN . /app/bin/activate && pip install mysqlclient - ADD --chown=acait:acait . /app/ -ADD --chown=acait:acait docker/ project/ -ADD --chown=acait:acait docker/app_deploy.sh /scripts +ADD --chown=acait:acait docker/ /app/project/ ADD --chown=acait:acait docker/app_start.sh /scripts -RUN chmod u+x /scripts/app_deploy.sh +RUN chmod u+x /scripts/app_start.sh + +RUN . /app/bin/pip install -r requirements.txt +RUN . /app/bin/pip install psycopg2 RUN . /app/bin/activate && pip install nodeenv && nodeenv -p &&\ npm install -g npm && ./bin/npm install less -g @@ -25,7 +20,7 @@ RUN . /app/bin/activate && pip install nodeenv && nodeenv -p &&\ RUN . /app/bin/activate && python manage.py collectstatic --noinput &&\ python manage.py compress -f -FROM gcr.io/uwit-mci-axdd/django-test-container:${DJANGO_CONTAINER_VERSION} as app-test-container +FROM us-docker.pkg.dev/uwit-mci-axdd/containers/django-test-container:${DJANGO_CONTAINER_VERSION} as app-test-container COPY --from=app-container /app/ /app/ COPY --from=app-container /static/ /static/ diff --git a/docker/prod-values.yml b/docker/prod-values.yml index ae696e2..5a1c7c7 100644 --- a/docker/prod-values.yml +++ b/docker/prod-values.yml @@ -67,18 +67,15 @@ externalService: enabled: true name: mdot-db-service type: ClusterIP - serviceAddress: 172.18.0.37 - servicePort: 3306 + serviceAddress: 172.18.1.206 + servicePort: 5432 database: - engine: mysql + engine: postgres name: mdot_prod hostname: mdot-db-service secretName: prod.mdot.uw.edu-sql-secrets repo: mdot instance: prod -image: - repository: gcr.io/uwit-mci-axdd/mdot - tag: IMAGE_TAG memcached: enabled: false cronjob: @@ -105,7 +102,7 @@ externalSecrets: enabled: true secrets: - name: prod.mdot.uw.edu-secrets - externalKey: axdd/kv/data/mdot/prod/secrets + externalKey: mdot/prod/secrets data: - name: admin-authz-group property: admin-authz-group @@ -122,26 +119,26 @@ externalSecrets: - name: mdot-ux-contact property: mdot-ux-contact - name: prod.mdot.uw.edu-sql-secrets - externalKey: axdd/kv/data/mdot/prod/sql-secrets + externalKey: mdot/prod/sql-secrets data: - name: username property: username - name: password property: password - name: prod.mdot.uw.edu-uwca-certs - externalKey: axdd/kv/data/mdot/prod/uwca-certs + externalKey: mdot/prod/uwca-certs data: - name: prod.mdot.uw.edu-uwca.cert property: prod.mdot.uw.edu-uwca.cert - name: prod.mdot.uw.edu-uwca.key property: prod.mdot.uw.edu-uwca.key - name: prod.mdot.uw.edu-ic-cert - externalKey: axdd/kv/data/mdot/prod/ic-certs + externalKey: mdot/prod/ic-certs data: - name: prod.mdot.uw.edu-ic.cert property: prod.mdot.uw.edu-ic.cert - name: prod.mdot.uw.edu-uw-idp-cert - externalKey: axdd/kv/data/idp-cert + externalKey: idp-cert data: - name: uw-idp-cert property: cert diff --git a/docker/test-values.yml b/docker/test-values.yml index 3963d0e..191c43f 100644 --- a/docker/test-values.yml +++ b/docker/test-values.yml @@ -40,18 +40,15 @@ externalService: enabled: true name: mdot-db-service type: ClusterIP - serviceAddress: 172.18.0.37 - servicePort: 3306 + serviceAddress: 172.18.1.206 + servicePort: 5432 database: - engine: mysql + engine: postgres name: mdot_test hostname: mdot-db-service secretName: test.mdot.uw.edu-sql-secrets repo: mdot instance: test -image: - repository: gcr.io/uwit-mci-axdd/mdot - tag: IMAGE_TAG memcached: enabled: false cronjob: @@ -78,7 +75,7 @@ externalSecrets: enabled: true secrets: - name: test.mdot.uw.edu-secrets - externalKey: axdd/kv/data/mdot/test/secrets + externalKey: mdot/test/secrets data: - name: admin-authz-group property: admin-authz-group @@ -95,26 +92,26 @@ externalSecrets: - name: mdot-ux-contact property: mdot-ux-contact - name: test.mdot.uw.edu-sql-secrets - externalKey: axdd/kv/data/mdot/test/sql-secrets + externalKey: mdot/test/sql-secrets data: - name: username property: username - name: password property: password - name: test.mdot.uw.edu-uwca-certs - externalKey: axdd/kv/data/mdot/test/uwca-certs + externalKey: mdot/test/uwca-certs data: - name: test.mdot.uw.edu-uwca.cert property: test.mdot.uw.edu-uwca.cert - name: test.mdot.uw.edu-uwca.key property: test.mdot.uw.edu-uwca.key - name: test.mdot.uw.edu-ic-certs - externalKey: axdd/kv/data/mdot/test/ic-certs + externalKey: mdot/test/ic-certs data: - name: test.mdot.uw.edu-ic.cert property: test.mdot.uw.edu-ic.cert - name: test.mdot.uw.edu-uw-idp-cert - externalKey: axdd/kv/data/idp-cert + externalKey: idp-cert data: - name: uw-idp-cert property: cert From 50dba74cc3662fbdd0b61f9d6dcb31797c162d07 Mon Sep 17 00:00:00 2001 From: Jim Laney Date: Mon, 16 Oct 2023 16:30:38 -0700 Subject: [PATCH 2/2] fix install --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3be571..1a38ada 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,8 @@ ADD --chown=acait:acait docker/ /app/project/ ADD --chown=acait:acait docker/app_start.sh /scripts RUN chmod u+x /scripts/app_start.sh -RUN . /app/bin/pip install -r requirements.txt -RUN . /app/bin/pip install psycopg2 +RUN /app/bin/pip install -r requirements.txt +RUN /app/bin/pip install psycopg2 RUN . /app/bin/activate && pip install nodeenv && nodeenv -p &&\ npm install -g npm && ./bin/npm install less -g