From f81cdd2fe1fd2dceffb4d21c418e0eba8c29cd87 Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Wed, 22 May 2024 20:46:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - netdata - gitea - дополнил ридми - добавил команду для ssh-логина --- README.md | 19 +++++++++++++++---- Taskfile.yml | 13 ++++++++++++- ansible/configuration.yml | 5 ++++- app/gitea/docker-compose.yml | 2 +- app/gitea/tasks.py | 2 ++ 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 433636c..b0a717b 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ ## Установка - $ cp ansible-vault-password-file.dist ansible-vault-password-file - $ ansible-galaxy install --role-file ansible/requirements.yml +```bash +$ cp ansible-vault-password-file.dist ansible-vault-password-file +$ ansible-galaxy install --role-file ansible/requirements.yml +``` ## Структура @@ -24,8 +26,17 @@ Конфигурация приложений (если нужно добавить новое приложение): - $ make configure-apps-in-prod +```bash +$ task configure-apps +``` Конфигурация мониторинга (если нужно обновить netdata): - $ make configure-monitoring +```bash +$ task configure-monitoring +``` + +## Деплой приложений + +- Нужно зайти в директорию приложения. Например, `app/gitea`. +- Выполнить из директории приложения `invoke deploy`. diff --git a/Taskfile.yml b/Taskfile.yml index 5fab5b3..00d9131 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -7,8 +7,15 @@ vars: sh: id -u GROUP_ID: sh: id -g + REMOTE_USER: 'major' + REMOTE_HOST: + sh: cat ./ansible/hosts_prod | xargs tasks: + ssh: + cmds: + - ssh {{.REMOTE_USER}}@{{.REMOTE_HOST}} + edit-vars: cmds: - ansible-vault edit ansible/vars/vars.yml @@ -30,7 +37,7 @@ tasks: cmds: - >- ansible-playbook - --user="major" + --user="{{.REMOTE_USER}}" --become --inventory="ansible/hosts_prod" --extra-vars="ansible_python_interpreter=/usr/bin/python3" @@ -38,6 +45,10 @@ tasks: -vvv ansible/configuration.yml + configure-all: + cmds: + - task: configure + configure-monitoring: cmds: - task: configure diff --git a/ansible/configuration.yml b/ansible/configuration.yml index 928d314..a4bdfb9 100644 --- a/ansible/configuration.yml +++ b/ansible/configuration.yml @@ -45,6 +45,9 @@ - import_role: name: geerlingguy.docker + vars: + docker_users: + - major tags: - docker @@ -71,7 +74,7 @@ - import_role: name: netdata vars: - netdata_version: 'v1.43.2' + netdata_version: 'v1.45.5' netdata_exposed_port: '{{ netdata_port }}' tags: - monitoring diff --git a/app/gitea/docker-compose.yml b/app/gitea/docker-compose.yml index efc89bb..86aac1e 100644 --- a/app/gitea/docker-compose.yml +++ b/app/gitea/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: server: - image: gitea/gitea:1.20.5 + image: gitea/gitea:1.21.11 environment: - "USER_UID=${USER_UID}" - "USER_GID=${USER_GID}" diff --git a/app/gitea/tasks.py b/app/gitea/tasks.py index b2ffcda..012620a 100644 --- a/app/gitea/tasks.py +++ b/app/gitea/tasks.py @@ -2,6 +2,8 @@ from fabric import Connection from invoke import task import shlex +# Run task with `invoke deploy` + APP_NAME = "gitea" SSH_HOST = f"{APP_NAME}@158.160.115.150"