Skip to content

Commit

Permalink
Merge pull request #1546 from akvo/feature/1545-prod-documentation
Browse files Browse the repository at this point in the history
[#1545] Initial changes to add documentation on prod URL
  • Loading branch information
anjarakvo authored Sep 17, 2024
2 parents 8d1c716 + 7dfd8df commit de2d5d2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/composite-actions/ssh-docker-compose/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
docker-compose-file-frontend-build:
description: 'Docker compose for frontend build file location'
required: true
docker-compose-file-documentation-build:
description: 'Docker compose for documentation build file location'
required: true
ci_commit:
description: 'Commit ID'
required: true
Expand All @@ -34,6 +37,10 @@ runs:
run: .github/composite-actions/ssh-docker-compose/git-pull.sh ${{ inputs.server-ip }} ${{ inputs.server-ssh-port }} ${{ inputs.server-ssh-user }}
shell: bash

- name: Rebuild Documentation
run: .github/composite-actions/ssh-docker-compose/documentation-build.sh ${{ inputs.server-ip }} ${{ inputs.server-ssh-port }} ${{ inputs.server-ssh-user }} ${{ inputs.docker-compose-file-documentation-build }} ${{ inputs.ci_commit }}
shell: bash

- name: Rebuild Frontend
run: .github/composite-actions/ssh-docker-compose/frontend-build.sh ${{ inputs.server-ip }} ${{ inputs.server-ssh-port }} ${{ inputs.server-ssh-user }} ${{ inputs.docker-compose-file-frontend-build }} ${{ inputs.ci_commit }}
shell: bash
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -eu

# ${1} for Server IP
# ${2} for Server Port
# ${3} for Server User
# ${4} for Dockerfile location

server_ip="${1}"
server_port="${2}"
server_user="${3}"
docker_compose_file="${4}"
ci_commit="${5}"

ssh -i priv.key -o BatchMode=yes \
-p "${server_port}" \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
"${server_user}"@"${server_ip}" "cd src/deploy && CI_COMMIT=${ci_commit} docker compose -f ${docker_compose_file} up --build"
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
server-ssh-user: ${{ secrets.SERVER_SSH_USER }}
docker-compose-file: ${{ secrets.DOCKER_COMPOSE_FILE }}
docker-compose-file-frontend-build: ${{ secrets.DOCKER_COMPOSE_FILE_FRONTEND_BUILD }}
docker-compose-file-documentation-build: ${{ secrets.DOCKER_COMPOSE_FILE_DOCUMENTATION_BUILD }}
ci_commit: ${{ env.COMMIT_SHORT_SHA }}

mobile-app-release:
Expand Down
18 changes: 18 additions & 0 deletions deploy/docker-compose.documentation-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
services:
documentation_build:
image: akvo/akvo-sphinx:20220525.082728.594558b
container_name: documentation_build
working_dir: /docs
environment:
- CI_COMMIT=${CI_COMMIT}
command:
- /bin/bash
- -c
- |
ls -la
make html
cp -r build/html ../frontend/public/documentation
volumes:
- ../docs:/docs:delegated
- ../frontend:/frontend:delegated
7 changes: 7 additions & 0 deletions deploy/generate_dynamic_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ http:
service: frontend-service
tls:
certResolver: myresolver
middlewares:
- redirect-documentation
middlewares:
redirect-to-https:
redirectScheme:
scheme: "https"
permanent: true
redirect-documentation:
redirectRegex:
regex: "^https://${WEBDOMAIN}/documentation$"
replacement: "https://${WEBDOMAIN}/documentation/"
permanent: true
services:
frontend-service:
Expand Down

0 comments on commit de2d5d2

Please sign in to comment.