Compare commits
7
Commits
e32cb57ebe
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f0bc68120 | ||
|
|
87b522bfa9 | ||
|
|
e68f374152 | ||
|
|
5549840536 | ||
|
|
68bb418d36 | ||
|
|
f2570732e1 | ||
|
|
4525ea1e19 |
No files matched your search
@@ -0,0 +1,51 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
- 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: 338 KiB After Width: | Height: | Size: 257 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 324 KiB After Width: | Height: | Size: 341 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 303 KiB |
+1
-1
@@ -23,7 +23,7 @@ def send_lead_to_email(name, phone, email, diskription):
|
|||||||
SMTP_PORT = 587
|
SMTP_PORT = 587
|
||||||
SENDER_EMAIL = "rkplastic@yandex.ru"
|
SENDER_EMAIL = "rkplastic@yandex.ru"
|
||||||
SENDER_PASSWORD = os.environ.get('EMAIL_PASS')
|
SENDER_PASSWORD = os.environ.get('EMAIL_PASS')
|
||||||
RECIPIENT_EMAIL = "w0ron.black@yandex.ru"
|
RECIPIENT_EMAIL = "rkplastic@mail.ru"
|
||||||
|
|
||||||
if not SENDER_PASSWORD:
|
if not SENDER_PASSWORD:
|
||||||
logger.error("❌ Не найдена переменная окружения EMAIL_PASS")
|
logger.error("❌ Не найдена переменная окружения EMAIL_PASS")
|
||||||
|
|||||||
Reference in new issue
Block a user