Skip to content

Commit

Permalink
mount aws.credentials as volume and adapt infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Nov 4, 2024
1 parent 3c72492 commit d3d52c2
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 22 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ env:

jobs:
deploy-test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
concurrency: deploy-test
env:
SERVER_PORT_CONFERENCES: 1005
SERVER_PORT_PUSH_NOTIFICATIONS: 1006
DOCKER_TAG: ${{ github.sha }}-test
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/sfscon-backend-test
DOCKER_IMAGE_WEBSERVER: ghcr.io/${{ github.repository }}/sfscon-backend-webserver-test
steps:
- name: Checkout source code
uses: actions/checkout@v4
Expand All @@ -30,6 +31,7 @@ jobs:
X_SERVER_PORT_PUSH_NOTIFICATIONS: ${{ env.SERVER_PORT_PUSH_NOTIFICATIONS }}

X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE}}
X_DOCKER_IMAGE_WEBSERVER: ${{ env.DOCKER_IMAGE_WEBSERVER }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}

Expand All @@ -49,11 +51,18 @@ jobs:

X_LANE_USERNAME_PREFIX: ${{ secrets.ADMIN_USERNAME }}


X_XML_URL: "https://www.sfscon.it/?calendar=2023&format=xml"
X_REDIS_SERVER: redis


- name: Create .aws.credentials file and inject values
env:
AWS_KEY_ID_TEST: ${{ secrets.AWS_KEY_ID_TEST }}
AWS_ACCESS_KEY_TEST: ${{ secrets.AWS_ACCESS_KEY_TEST }}
run: |
cp aws.credentials.example .aws.credentials
sed -i "s/KEY_ID/$AWS_KEY_ID_TEST/" .aws.credentials
sed -i "s/ACCESS_KEY/$AWS_ACCESS_KEY_TEST/" .aws.credentials
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions aws.credentials.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[default]
aws_access_key_id=__KEY_ID__
aws_secret_access_key=__ACCESS_KEY__
region=eu-central-1
aws_access_key_id=KEY_ID
aws_secret_access_key=ACCESS_KEY
region=eu-west-1
2 changes: 2 additions & 0 deletions infrastructure/ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
remote: docker-compose.yml
- local: ../../.env
remote: .env
- local: ../../.aws.credentials
remote: .aws.credentials
6 changes: 5 additions & 1 deletion infrastructure/docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
services:

app:
image: ${DOCKER_IMAGE}:${DOCKER_TAG}
build:
context: ../
dockerfile: infrastructure/docker/Dockerfile
webserver:
image: ${DOCKER_IMAGE_WEBSERVER}:${DOCKER_TAG}
build:
context: ../
dockerfile: infrastructure/docker/Dockerfile.webserver
12 changes: 11 additions & 1 deletion infrastructure/docker-compose.run.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
services:

webserver:
image: ${DOCKER_IMAGE_WEBSERVER}:${DOCKER_TAG}
depends_on:
conferences:
condition: service_started
push_notifications:
condition: service_started
ports:
- 8001:80

conferences:
image: ${DOCKER_IMAGE}:${DOCKER_TAG}
Expand All @@ -9,7 +19,7 @@ services:
- "${SERVER_PORT_CONFERENCES}:8000"
volumes:
- opencon-logs:/var/log/opencon
healthcheck:
- .aws.credentials:/root/.aws/credentials
test: curl --fail http://localhost:8000/openapi.json || exit 1
interval: 30s
retries: 3
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ RUN chmod +x /start.sh

COPY ./src/scripts /scripts

COPY ./aws.credentials /root/.aws/credentials
# COPY ./aws.credentials /root/.aws/credentials

CMD ["./start.sh"]
CMD ["./start.sh"]
13 changes: 1 addition & 12 deletions infrastructure/docker/Dockerfile.webserver
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@ FROM node:latest AS build

WORKDIR /app


# TODO: REMOVE THIS

RUN git clone https://github.com/digital-cube/sfscon2024-admin.git



# TODO: UNCOMMENT THIS
# RUN git clone https://github.com/noi-techpark/it.sfscon.app.webadmin.git sfscon2024-admin



RUN git clone https://github.com/noi-techpark/it.sfscon.app.webadmin.git sfscon2024-admin

WORKDIR /app/sfscon2024-admin

Expand Down

0 comments on commit d3d52c2

Please sign in to comment.