From 2750c6a744a412deaad23c4a1e78c43352c44bdb Mon Sep 17 00:00:00 2001 From: Florentin Labelle <florentin.labelle@student-cs.fr> Date: Wed, 12 Oct 2022 10:12:01 +0200 Subject: [PATCH] Add deploy instructions --- deploy/calculator.service | 12 ++++++++++++ deploy/setup.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 deploy/calculator.service create mode 100644 deploy/setup.md diff --git a/deploy/calculator.service b/deploy/calculator.service new file mode 100644 index 0000000..8fdabe0 --- /dev/null +++ b/deploy/calculator.service @@ -0,0 +1,12 @@ +Description=CiCd. +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +ExecStart=python3 -m uvicorn server:app --port 80 --host 0.0.0.0 +User=root +WorkingDirectory=/var/www/cicd/calculator + +[Install] +WantedBy=multi-user.target diff --git a/deploy/setup.md b/deploy/setup.md new file mode 100644 index 0000000..7ab3d03 --- /dev/null +++ b/deploy/setup.md @@ -0,0 +1,29 @@ +# Setup la vm pour notre calculatrice + +## Clone le repo + +```bash +mkdir -p /var/www +cd /var/www +git clone https://gitlab.viarezo.fr/<login>/cicd.git +``` + +## Installe les dépendances + +```bash +cd cicd +pip install -r requirements.txt +``` + +## Ajoute le service + +```bash +cp deploy/calculator.service /etc/systemd/system/ +systemctl daemon-reload +systemctl enable calculator +systemctl start calculator +``` + +## Dans ton navigateur + +- "http://ip-de-la-vm:80/" -- GitLab