Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e32cb57ebe |
No files matched your search
@@ -1,51 +0,0 @@
|
||||
name: Build, Test and Push Flask App
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.11'
|
||||
|
||||
jobs:
|
||||
deploy-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Ansible
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y ansible openssh-client
|
||||
|
||||
- name: Set up SSH key
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_RELEASE_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
printf '%s' "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keygen -y -f ~/.ssh/deploy_key >/dev/null
|
||||
|
||||
- name: Trust server host key
|
||||
run: |
|
||||
ssh-keyscan -H "${{ secrets.RELEASE_SERVER_IP }}" >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Test SSH
|
||||
run: |
|
||||
ssh \
|
||||
-i ~/.ssh/deploy_key \
|
||||
-o StrictHostKeyChecking=yes \
|
||||
"${{ secrets.RELEASE_SERVER_USER }}@${{ secrets.RELEASE_SERVER_IP }}" \
|
||||
'echo SSH works'
|
||||
|
||||
- name: Run Ansible playbook
|
||||
run: |
|
||||
ansible-playbook \
|
||||
-i "${{ secrets.RELEASE_SERVER_IP }}," \
|
||||
ansible/restart_release_compose.yml \
|
||||
--user "${{ secrets.RELEASE_SERVER_USER }}" \
|
||||
--private-key ~/.ssh/deploy_key
|
||||
@@ -1,15 +0,0 @@
|
||||
- name: Restart Docker Compose services
|
||||
hosts: all
|
||||
# become: yes # <-- больше не нужно, т.к. пользователь уже имеет права Docker
|
||||
tasks:
|
||||
- name: docker compose down
|
||||
ansible.builtin.shell:
|
||||
cmd: docker compose down pvh-backend
|
||||
chdir: ~/web
|
||||
- name: prune system
|
||||
ansible.builtin.shell:
|
||||
cmd: docker system prune -a -f
|
||||
- name: docker compose up -d
|
||||
ansible.builtin.shell:
|
||||
cmd: docker compose up -d pvh-backend
|
||||
chdir: ~/web
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 338 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 341 KiB After Width: | Height: | Size: 324 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 241 KiB |
Reference in new issue
Block a user