Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(openchallenges): replace Nginx by Caddy project (ARCH-354) #2934

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions apps/openchallenges/apex/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
debug
}

:80 {
handle_path /api-docs* {
reverse_proxy {env.API_DOCS_HOST}:{env.API_DOCS_PORT}
}

handle_path /api* {
reverse_proxy {env.API_GATEWAY_HOST}:{env.API_GATEWAY_PORT}
}

handle_path /health {
respond `{"status":"healthy"}` 200
header Content-Type application/json
}

handle_path /img* {
reverse_proxy {env.THUMBOR_HOST}:{env.THUMBOR_PORT}
}

handle_path /zipkin* {
rewrite * /zipkin{uri}
reverse_proxy {env.ZIPKIN_HOST}:{env.ZIPKIN_PORT}
}

handle {
reverse_proxy {env.APP_HOST}:{env.APP_PORT}
}
}
13 changes: 4 additions & 9 deletions apps/openchallenges/apex/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
FROM nginx:1.25.1-alpine
FROM caddy:2.8.4

RUN apk add --no-cache jq
RUN apk add --no-cache curl jq

HEALTHCHECK --interval=2s --timeout=3s --retries=20 --start-period=5s \
CMD curl --fail --silent "localhost:8000/health" | jq '.status' | grep UP || exit 1
CMD curl --fail --silent "localhost:80/health" | jq '.status' | grep healthy || exit 1

COPY templates /etc/nginx/templates/
COPY nginx.conf /etc/nginx/

EXPOSE 8000

CMD ["nginx", "-g", "daemon off;"]
COPY Caddyfile /etc/caddy/
8 changes: 0 additions & 8 deletions apps/openchallenges/apex/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions apps/openchallenges/apex/nginx.conf

This file was deleted.

8 changes: 3 additions & 5 deletions apps/openchallenges/apex/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "openchallenges-apex",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/openchallenges-apex/src",
"projectType": "application",
"targets": {
"create-config": {
Expand All @@ -14,17 +13,16 @@
"serve-detach": {
"executor": "nx:run-commands",
"options": {
"command": "docker/openchallenges/serve-detach.sh openchallenges-apex"
"command": "docker/openchallenges/serve-detach.sh {projectName}"
}
},
"scan-image": {
"executor": "nx:run-commands",
"options": {
"command": "trivy image ghcr.io/sage-bionetworks/openchallenges-apex:local --quiet",
"command": "trivy image ghcr.io/sage-bionetworks/{projectName}:local --quiet",
"color": true
}
}
},
"tags": ["type:service", "scope:backend"],
"implicitDependencies": []
"tags": ["type:service", "scope:backend"]
}
3 changes: 0 additions & 3 deletions apps/openchallenges/apex/templates/events.conf.template

This file was deleted.

118 changes: 0 additions & 118 deletions apps/openchallenges/apex/templates/http.conf.template

This file was deleted.

8 changes: 3 additions & 5 deletions docker/openchallenges/services/apex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ services:
restart: always
env_file:
- ../../../apps/openchallenges/apex/.env
# volumes:
# - ../../../apps/openchallenges/apex/nginx.conf:/etc/nginx/nginx.conf
# - ../../../apps/openchallenges/apex/templates:/etc/nginx/templates
volumes:
- ../../../apps/openchallenges/apex/Caddyfile:/etc/caddy/Caddyfile
networks:
- openchallenges
ports:
- '8000:8000'
- '8000:80'
depends_on:
openchallenges-api-docs:
condition: service_healthy
Expand All @@ -21,7 +20,6 @@ services:
condition: service_started
openchallenges-zipkin:
condition: service_healthy

deploy:
resources:
limits:
Expand Down
Loading