From 4a3ed3d38cec13b4a63a0c4a4b873f6ef115d297 Mon Sep 17 00:00:00 2001 From: Jeremy PASTOURET Date: Wed, 7 Aug 2024 17:43:25 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20ajout=20de=20param=C3=A9trage=20pour?= =?UTF-8?q?=20g=C3=A9rer=20les=20M1=20plus=20proprement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- local/Dockerfile | 2 +- local/Vagrantfile | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/local/Dockerfile b/local/Dockerfile index 5eda0cd8..1f82d61c 100644 --- a/local/Dockerfile +++ b/local/Dockerfile @@ -1,5 +1,5 @@ FROM debian:11.6 -ENV container docker +ENV container=docker RUN apt-get update -y && apt-get dist-upgrade -y RUN apt-get install -y --no-install-recommends ssh sudo wget curl cron software-properties-common build-essential libffi-dev systemd openssh-client net-tools diff --git a/local/Vagrantfile b/local/Vagrantfile index 29098915..2d7294d4 100644 --- a/local/Vagrantfile +++ b/local/Vagrantfile @@ -14,10 +14,22 @@ Vagrant.configure("2") do |config| config.vm.provider "docker" do |docker, override| override.vm.box = nil docker.build_dir = "." + + platform = `uname -m`.strip + is_arm64 = platform == "arm64" || platform == "aarch64" + + # Conditional arguments for ARM64 platform + if is_arm64 + docker.build_args = "--platform=linux/arm64" + docker.create_args = ["--platform=linux/arm64"] + end + + docker.build_args = "--platform=linux/arm64" + docker.name = "ctn_aides_jeunes" override.ssh.insert_key = true docker.has_ssh = true - docker.privileged = true - docker.ports = ["8001:8001", "2001:2001", "8002:8002", "2002:2002", "8887:8887"] + docker.privileged = true + docker.ports = ["8001:8001", "2001:2001", "8002:8002", "2002:2002", "8887:8887"] end # Faster startup From 49afc31767439d61490bccd5c2ab668517f47957 Mon Sep 17 00:00:00 2001 From: Jeremy PASTOURET Date: Mon, 12 Aug 2024 17:01:42 +0200 Subject: [PATCH 2/2] feat: passage a la version 12 de debian --- README.md | 2 +- local/Dockerfile | 2 +- local/Vagrantfile | 4 +-- roles/bootstrap/defaults/main.yaml | 1 + roles/bootstrap/tasks/install_mongodb.yaml | 14 ++++---- roles/bootstrap/tasks/install_node.yaml | 40 ++++++++++++++++------ 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index a9e899c4..5ba1fdd1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/local/Dockerfile b/local/Dockerfile index 1f82d61c..fbdda5f6 100644 --- a/local/Dockerfile +++ b/local/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:11.6 +FROM debian:12 ENV container=docker RUN apt-get update -y && apt-get dist-upgrade -y diff --git a/local/Vagrantfile b/local/Vagrantfile index 2d7294d4..2dcce7d7 100644 --- a/local/Vagrantfile +++ b/local/Vagrantfile @@ -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` @@ -25,7 +25,7 @@ Vagrant.configure("2") do |config| end docker.build_args = "--platform=linux/arm64" - docker.name = "ctn_aides_jeunes" + docker.name = "ctn_aides_jeunes_deb_12" override.ssh.insert_key = true docker.has_ssh = true docker.privileged = true diff --git a/roles/bootstrap/defaults/main.yaml b/roles/bootstrap/defaults/main.yaml index 283c6ddc..67a73e8b 100644 --- a/roles/bootstrap/defaults/main.yaml +++ b/roles/bootstrap/defaults/main.yaml @@ -5,3 +5,4 @@ server_user_group: aides_jeunes webroot_path: /var/www is_default: false challenge_proxy: false +node_version: "18" \ No newline at end of file diff --git a/roles/bootstrap/tasks/install_mongodb.yaml b/roles/bootstrap/tasks/install_mongodb.yaml index ef992c39..feb57e25 100644 --- a/roles/bootstrap/tasks/install_mongodb.yaml +++ b/roles/bootstrap/tasks/install_mongodb.yaml @@ -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 diff --git a/roles/bootstrap/tasks/install_node.yaml b/roles/bootstrap/tasks/install_node.yaml index 26d08c20..9b70ca03 100644 --- a/roles/bootstrap/tasks/install_node.yaml +++ b/roles/bootstrap/tasks/install_node.yaml @@ -1,14 +1,32 @@ --- -- 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 - ansible.builtin.apt: - update_cache: true + +- name: Download node.js installation script + get_url: + url: https://deb.nodesource.com/setup_{{ node_version }}.x + dest: /tmp/nodesource_setup.sh + +- name: make node script exectuable + file: dest=/tmp/nodesource_setup.sh mode=a+x + +- name: Run the nodesource setup script + become: true + command: sh /tmp/nodesource_setup.sh + +- name: remove exisiting package + become: true + apt: + name: nodejs + state: absent + purge: true + +- name: update and install nodejs + become: true + apt: name: nodejs state: present + update_cache: true + +- name: Clean up NodeSource setup script + ansible.builtin.file: + path: /tmp/nodesource_setup.sh + state: absent \ No newline at end of file