diff --git a/entrypoint b/entrypoint index 7e239949..eda1937a 100644 --- a/entrypoint +++ b/entrypoint @@ -8,7 +8,13 @@ if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}" fi -export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" + +# omit the port when running on App Engine, Cloud Run etc +if [ -z "${INSTANCE_CONNECTION_NAME}"]; then + export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" +else + export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}" +fi postgres_ready() { python << END diff --git a/local.yml b/local.yml deleted file mode 100644 index cca69f92..00000000 --- a/local.yml +++ /dev/null @@ -1,76 +0,0 @@ -version: "3" - -volumes: - local_postgres_data: {} - local_postgres_data_backups: {} - -services: - django: &django - build: - context: . - dockerfile: ./compose/local/django/Dockerfile - image: pepfar_mle_local_django - container_name: django - depends_on: - - postgres - - mailhog - volumes: - - .:/app:z - env_file: - - ./.envs/.local/.django - - ./.envs/.local/.postgres - ports: - - "8000:8000" - command: /start - - postgres: - build: - context: . - dockerfile: ./compose/production/postgres/Dockerfile - image: pepfar_mle_production_postgres - container_name: postgres - volumes: - - local_postgres_data:/var/lib/postgresql/data:Z - - local_postgres_data_backups:/backups:z - env_file: - - ./.envs/.local/.postgres - - docs: - image: pepfar_mle_local_docs - container_name: docs - build: - context: . - dockerfile: ./compose/local/docs/Dockerfile - env_file: - - ./.envs/.local/.django - volumes: - - ./docs:/docs:z - - ./config:/app/config:z - - ./pepfar_mle:/app/pepfar_mle:z - ports: - - "7000:7000" - command: /start-docs - - mailhog: - image: mailhog/mailhog:v1.0.0 - container_name: mailhog - ports: - - "8025:8025" - - node: - build: - context: . - dockerfile: ./compose/local/node/Dockerfile - image: pepfar_mle_local_node - container_name: node - depends_on: - - django - volumes: - - .:/app:z - # http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html - - /app/node_modules - command: npm run dev - ports: - - "3000:3000" - # Expose browsersync UI: https://www.browsersync.io/docs/options/#option-ui - - "3001:3001"