Skip to content

Commit

Permalink
Temp: Disable Docker healthcheck & _ nginx.conf
Browse files Browse the repository at this point in the history
- Commented out Docker healthcheck to avoid unnecessary retries.
- Set Nginx server_name to wildcard (_) to allow all incoming requests.
- Commented out build args for simplicity in initial push.
This commit will be reverted once the relevant build args are finalised and handled properly.
  • Loading branch information
aaronskiba committed Feb 26, 2025
1 parent bbb672f commit d19ab7e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docker-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:
cache-from: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-api
# Push the updated build cache to Docker Hub
cache-to: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-api,mode=max
build-args: |
SERVER_NAME=uat.library.ualberta.ca
# build-args: |
# SERVER_NAME=uat.library.ualberta.ca

- name: Build and push the web stage image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
Expand All @@ -95,5 +95,5 @@ jobs:
cache-from: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-web
# Push the updated build cache to Docker Hub
cache-to: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-web,mode=max
build-args: |
SERVER_NAME=uat.library.ualberta.ca
# build-args: |
# SERVER_NAME=uat.library.ualberta.ca
8 changes: 4 additions & 4 deletions .github/workflows/docker-push-uat-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ jobs:
cache-from: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-api
# Push the updated build cache to Docker Hub
cache-to: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-api,mode=max
build-args: |
SERVER_NAME=uat.library.ualberta.ca
# build-args: |
# SERVER_NAME=uat.library.ualberta.ca

- name: Build and push the web stage image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
Expand All @@ -96,5 +96,5 @@ jobs:
cache-from: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-web
# Push the updated build cache to Docker Hub
cache-to: type=registry,ref=ualbertalib/dmp_roadmap:build-cache-web,mode=max
build-args: |
SERVER_NAME=uat.library.ualberta.ca
# build-args: |
# SERVER_NAME=uat.library.ualberta.ca
26 changes: 13 additions & 13 deletions Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ rm -rf ${INSTALL_PATH}/node_modules ${INSTALL_PATH}/tmp/*
FROM ruby:$RUBY_VERSION AS api

ARG NODE_VERSION
ARG BASE_URL
ENV INSTALL_PATH=/usr/src/app \
HEALTHCHECK_URL=${BASE_URL}/api/v1/heartbeat
# ARG BASE_URL
ENV INSTALL_PATH=/usr/src/app
# HEALTHCHECK_URL=${BASE_URL}/api/v1/heartbeat

# - postgresql16-client: Required for pg gem to connect to PostgreSQL
# - imagemagick: Required for dragonfly gem to process images
Expand Down Expand Up @@ -116,27 +116,27 @@ USER dmpuser

EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget -qO- $HEALTHCHECK_URL || exit 1
# HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
# CMD wget -qO- $HEALTHCHECK_URL || exit 1


# nginx stage to serve static assets and proxy requests to api container
FROM nginx:alpine AS web

ARG SERVER_NAME
# ARG SERVER_NAME

ENV SERVER_NAME=$SERVER_NAME \
INSTALL_PATH=/usr/src/app
# ENV SERVER_NAME=$SERVER_NAME \
ENV INSTALL_PATH=/usr/src/app

COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=api ${INSTALL_PATH}/public/assets /usr/share/nginx/html/assets

# Perform envsubst substitution at runtime to set `server_name` value in nginx.conf
CMD envsubst '${SERVER_NAME}' < /etc/nginx/nginx.conf > /tmp/nginx.conf \
# Using a temporary file ensures the configuration is fully generated before Nginx starts.
&& mv /tmp/nginx.conf /etc/nginx/nginx.conf \
# Run Nginx in the foreground, allowing the Docker container to remain active.
&& nginx -g 'daemon off;'
# CMD envsubst '${SERVER_NAME}' < /etc/nginx/nginx.conf > /tmp/nginx.conf \
# # Using a temporary file ensures the configuration is fully generated before Nginx starts.
# && mv /tmp/nginx.conf /etc/nginx/nginx.conf \
# # Run Nginx in the foreground, allowing the Docker container to remain active.
# && nginx -g 'daemon off;'


EXPOSE 80
12 changes: 6 additions & 6 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ http {
default_type application/octet-stream;

# Default server block (404 page)
server {
listen 80 default_server;
server_name _;
return 404;
}
# server {
# listen 80 default_server;
# server_name _;
# return 404;
# }

# Main server block
server {
listen 80;
server_name ${SERVER_NAME};
server_name _;
root /usr/share/nginx/html;

# user nginx to serve static files
Expand Down

0 comments on commit d19ab7e

Please sign in to comment.