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"