-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infra): refactor structure playbooks (#15)
* feat: add monitoring agents * chore: add ga publish * refactor(infra): simplify structure * chore: quick pass down test
- Loading branch information
1 parent
dc85173
commit 6c84875
Showing
100 changed files
with
872 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Deployment | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: The environment to deploy to | ||
type: string | ||
required: true | ||
server_ip: | ||
description: The targeted server | ||
type: string | ||
required: true | ||
user: | ||
description: The server user to connect | ||
type: string | ||
required: true | ||
secrets: | ||
SSH_PRIVATE_KEY: | ||
description: SSH private key | ||
required: true | ||
SSH_KNOWN_HOSTS: | ||
description: SSH known hosts list | ||
required: true | ||
SLACK_WEBHOOK_URL: | ||
description: Slack webhook URL | ||
required: true | ||
outputs: | ||
status: | ||
description: Whether deployment succeeded or not | ||
value: ${{ jobs.deploy.outputs.status }} | ||
jobs: | ||
deploy: | ||
name: Deploy on ${{ inputs.environment }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Notify new deployment on Slack | ||
uses: ravsamhq/notify-slack-action@v2 | ||
if: always() | ||
with: | ||
status: ${{ job.status }} | ||
notification_title: "Déploiement en ${{ inputs.environment }} initié..." | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
- name: Checkout project | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Install SSH key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
name: github_actions | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | ||
config: | | ||
Host ${{inputs.server_ip}} | ||
HostName ${{inputs.server_ip}} | ||
User ${{inputs.user}} | ||
IdentityFile ~/.ssh/github_actions | ||
- name: Run playbook | ||
run: | | ||
bash .infra/scripts/deploy-app.sh ${{ inputs.environment }} | ||
- name: Notify failure on Slack | ||
uses: ravsamhq/notify-slack-action@v2 | ||
if: always() | ||
with: | ||
status: ${{ job.status }} | ||
notification_title: "Le déploiement en ${{ inputs.environment }} a échoué" | ||
notify_when: "failure" | ||
mention_groups: "!channel" | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
|
||
- name: Notify success on Slack | ||
uses: ravsamhq/notify-slack-action@v2 | ||
if: always() | ||
with: | ||
status: ${{ job.status }} | ||
notification_title: "Déploiement en ${{ inputs.environment }} terminé avec succès" | ||
notify_when: "success" | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish | ||
on: | ||
push: | ||
branches: [xxxx] | ||
|
||
jobs: | ||
publish-ghcr: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GH_FG_TOKEN }} | ||
|
||
- name: Build the reverse-proxy Docker image | ||
run: | | ||
docker build ./reverse_proxy --tag ghcr.io/mission-apprentissage/mna_bal_reverse_proxy:1.3.0 \ | ||
--label "org.opencontainers.image.source=https://github.com/mission-apprentissage/bal" \ | ||
--label "org.opencontainers.image.description=Reverse proxy bal" \ | ||
--label "org.opencontainers.image.licenses=MIT" | ||
docker push ghcr.io/mission-apprentissage/mna_bal_reverse_proxy:1.3.0 | ||
- name: Build the ui Docker image | ||
run: | | ||
docker build . -f "ui/Dockerfile" --tag ghcr.io/mission-apprentissage/mna_bal_ui:1.3.0 \ | ||
--label "org.opencontainers.image.source=https://github.com/mission-apprentissage/bal" \ | ||
--label "org.opencontainers.image.description=Ui bal" \ | ||
--label "org.opencontainers.image.licenses=MIT" | ||
docker push ghcr.io/mission-apprentissage/mna_bal_ui:1.3.0 | ||
- name: Build the server Docker image | ||
run: | | ||
docker build . -f "server/Dockerfile" --tag ghcr.io/mission-apprentissage/mna_bal_server:1.3.0 \ | ||
--label "org.opencontainers.image.source=https://github.com/mission-apprentissage/bal" \ | ||
--label "org.opencontainers.image.description=Server bal" \ | ||
--label "org.opencontainers.image.licenses=MIT" | ||
docker push ghcr.io/mission-apprentissage/mna_bal_server:1.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
.infra/ansible/roles/setup/files/app/.overrides/common/docker-compose.common.yml
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
.infra/ansible/roles/setup/files/app/.overrides/production/docker-compose.env.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.