-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
997ccba
commit 2815d8d
Showing
27 changed files
with
870 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ venv | |
db.sqlite3 | ||
.idea | ||
.vscode | ||
.env | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: ipr deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
build_backend_and_push_to_docker_hub: | ||
if: github.ref == 'refs/heads/main' | ||
name: Push Docker image to DockerHub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Push to DockerHub | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKER_NICKNAME }}/backend_ipr:latest | ||
|
||
deploy: | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build_backend_and_push_to_docker_hub | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Copy docker-compose.yml via ssh | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
passphrase: ${{ secrets.SSH_PASSPHRASE }} | ||
source: "docker-compose.production.yml" | ||
target: "ipr" | ||
- name: Executing remote ssh commands to deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
passphrase: ${{ secrets.SSH_PASSPHRASE }} | ||
script: | | ||
cd ipr | ||
sudo docker compose -f docker-compose.production.yml pull | ||
sudo docker compose -f docker-compose.production.yml down | ||
sudo docker compose -f docker-compose.production.yml up -d | ||
sudo docker compose -f docker-compose.production.yml exec backend python manage.py migrate | ||
sudo docker compose -f docker-compose.production.yml exec backend python manage.py collectstatic --noinput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM python:3.12 | ||
FROM python:3.12-slim | ||
|
||
WORKDIR /app | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 5.0.1 on 2024-01-27 21:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Comment", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"text", | ||
models.TextField( | ||
max_length=200, verbose_name="Комментарий" | ||
), | ||
), | ||
( | ||
"created_at", | ||
models.DateField( | ||
auto_now_add=True, verbose_name="Дата создания" | ||
), | ||
), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 5.0.1 on 2024-01-27 21:31 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("comments", "0001_initial"), | ||
("ipr", "0001_initial"), | ||
("tasks", "0001_initial"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="comment", | ||
name="author", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="comments", | ||
to=settings.AUTH_USER_MODEL, | ||
verbose_name="Автор комментария", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="comment", | ||
name="ipr", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="comments", | ||
to="ipr.ipr", | ||
verbose_name="ИПР", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="comment", | ||
name="task", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="comments", | ||
to="tasks.task", | ||
verbose_name="Задача", | ||
), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3' | ||
|
||
volumes: | ||
pg_data: | ||
static: | ||
media: | ||
|
||
services: | ||
db: | ||
image: postgres:13 | ||
env_file: .env | ||
volumes: | ||
- pg_data:/var/lib/postgresql/data | ||
backend: | ||
image: reamisd/backend_ipr:latest | ||
env_file: .env | ||
depends_on: | ||
- db | ||
volumes: | ||
- static:/app/static | ||
- media:/app/media | ||
gateway: | ||
image: nginx:latest | ||
depends_on: | ||
- backend | ||
env_file: .env | ||
ports: | ||
- "8080:80" | ||
volumes: | ||
- static:/static | ||
- media:/media | ||
- ./default.conf:/etc/nginx/conf.d/default.conf | ||
- ./error.log:/var/log/nginx/error.log | ||
- ./access.log:/var/log/nginx/access.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version: '3' | ||
|
||
volumes: | ||
pg_data: | ||
static: | ||
media: | ||
|
||
services: | ||
db: | ||
image: postgres:13 | ||
env_file: .env | ||
volumes: | ||
- pg_data:/var/lib/postgresql/data | ||
backend: | ||
build: . | ||
env_file: .env | ||
depends_on: | ||
- db | ||
volumes: | ||
- static:/app/static | ||
- media:/app/media | ||
gateway: | ||
depends_on: | ||
- backend | ||
build: ./nginx/ | ||
env_file: .env | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- static:/static | ||
- media:/media |
Oops, something went wrong.