Skip to content

Commit

Permalink
Merge dev -> main (#207)
Browse files Browse the repository at this point in the history
* chore: upgrade version github actions (cd.yml) (#201)

downgrade python github action to v4

fix cd

* Ajout wrapper cron sentry (#204)

* feat: ajoute un wrapper pour capturer les erreurs des crons sur sentry

* feat: add sentry-cli

* fix: indentation

* fix: sentry-cli install

* fix: sentry_wrapper_cron path

* fix: sentry wrapper fonctionnel

* fix: arg invalide en production - install ansible

* chore: bump pm2 v5.4.2 (#206)

* fix: utilise apt pour l'install ansible

* fix: utilise environnement virtuel pour l'install ansible

* fix: utilise environnement virtuel pour l'install ansible

* chore: reset pm2 v5.2

* fix: setup openfisca install

* Debian 11 to 12 (#208)

* fix: ajout de paramétrage pour gérer les M1 plus proprement

* feat: passage a la version 12 de debian

---------

Co-authored-by: Jeremy PASTOURET <[email protected]>

* chore: upgrade pm2 version

* trigger CD

---------

Co-authored-by: Jeremy PASTOURET <[email protected]>
  • Loading branch information
Shamzic and jenovateurs authored Jan 6, 2025
1 parent 293718f commit 40ffe42
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Set up the [Mes Aides](https://mes-aides.1jeune1solution.beta.gouv.fr/) stack.

## Before starting

The ansible scripts in this repository have been tested only Debian 11 x86_64 server. However, older or newer versions of Debian may be compatible.
The ansible scripts in this repository have been tested only Debian 12 x86_64 server. However, older or newer versions of Debian may be compatible.

## Deployment

Expand Down
2 changes: 1 addition & 1 deletion local/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:11.6
FROM debian:12
ENV container=docker

RUN apt-get update -y && apt-get dist-upgrade -y
Expand Down
4 changes: 2 additions & 2 deletions local/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64"
config.vm.box = "debian/bookwarm64"

# Guest have 500MB of RAM by default
# That is not enough to `npm ci`
Expand All @@ -24,7 +24,7 @@ Vagrant.configure("2") do |config|
end

docker.build_args = "--platform=linux/arm64"
docker.name = "ctn_aides_jeunes"
docker.name = "ctn_aides_jeunes_deb12"
override.ssh.insert_key = true
docker.has_ssh = true
docker.privileged = true
Expand Down
1 change: 1 addition & 0 deletions roles/bootstrap/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ server_user_group: aides_jeunes
webroot_path: /var/www
is_default: false
challenge_proxy: false
node_version: "18"
14 changes: 7 additions & 7 deletions roles/bootstrap/tasks/install_mongodb.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
- name: Install mongoDB 6.x
- name: Install mongoDB 7.x
block:
- name: Add mongoDB 6.x apt key
- name: Add mongoDB 7.x apt key
ansible.builtin.apt_key:
url: https://www.mongodb.org/static/pgp/server-6.0.asc
url: https://www.mongodb.org/static/pgp/server-7.0.asc
state: present
- name: Add mongoDB 6.x ppa for apt repo - arm64
- name: Add mongoDB 7.x ppa for apt repo - arm64
ansible.builtin.apt_repository:
repo: deb https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse
repo: deb https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse
update_cache: true
when: ansible_facts.machine == 'aarch64'
- name: Add mongoDB 6.x ppa for apt repo - amd64
- name: Add mongoDB 7.x ppa for apt repo - amd64
ansible.builtin.apt_repository:
repo: deb https://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main
repo: deb https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main
update_cache: true
when: ansible_facts.machine != 'aarch64'
- name: Install mongoDB
Expand Down
31 changes: 21 additions & 10 deletions roles/bootstrap/tasks/install_node.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
---
- name: Add nodejs apt key
ansible.builtin.apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
- name: Add nodejs 18.x ppa for apt repo
ansible.builtin.apt_repository:
repo: deb https://deb.nodesource.com/node_18.x bullseye main
update_cache: true
- name: Install nodejs

- name: Download node.js installation script
ansible.builtin.get_url:
url: https://deb.nodesource.com/setup_{{ node_version }}.x
dest: /tmp/nodesource_setup.sh
mode: '0755'

- name: Run the nodesource setup script
become: true
ansible.builtin.command: sh /tmp/nodesource_setup.sh
args:
creates: /usr/bin/node

- name: Update and install nodejs
become: true
ansible.builtin.apt:
update_cache: true
name: nodejs
state: present
update_cache: true

- name: Clean up NodeSource setup script
ansible.builtin.file:
path: /tmp/nodesource_setup.sh
state: absent
2 changes: 1 addition & 1 deletion roles/bootstrap/tasks/install_pm2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: Install pm2 package
community.general.npm:
name: pm2
version: "5.2"
version: "5.4.2"
global: true
state: present
production: true
Expand Down
7 changes: 4 additions & 3 deletions roles/bootstrap/tasks/setup_openfisca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
ansible.builtin.pip:
name: pip
virtualenv: "{{ venv_dir }}"
virtualenv_command: python3.11 -m venv
virtualenv_command: python3 -m venv
extra_args: --upgrade
- name: Install Openfisca requirements
become_user: "{{ server_user_name }}"
become: true
become_method: ansible.builtin.sudo
ansible.builtin.pip:
requirements: "{{ repository_folder }}/openfisca/requirements.txt"
virtualenv: "{{ venv_dir }}"
virtualenv_command: python3.11 -m venv
virtualenv_command: python3 -m venv
extra_args: --upgrade
- name: Setup openfisca service
ansible.builtin.template:
Expand Down
11 changes: 10 additions & 1 deletion synchronize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@
ansible.builtin.apt:
name: [git, python3-pip]
state: present
- name: Install ansible on host
- name: Install Python venv
ansible.builtin.apt:
name: python3-venv
state: present
- name: Create a virtual environment
ansible.builtin.command:
cmd: python3 -m venv /opt/venv
creates: /opt/venv
- name: Install ansible in the virtual environment
ansible.builtin.pip:
name: ansible
virtualenv: /opt/venv
- name: Clone application repository
ansible.builtin.git:
repo: "{{ ops.repository }}"
Expand Down

0 comments on commit 40ffe42

Please sign in to comment.