Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Mihálik committed Apr 14, 2024
1 parent 6b9be65 commit 31dd52f
Show file tree
Hide file tree
Showing 30 changed files with 972 additions and 36 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Deploy Development

on:
push:
branches: [ multiple-environments ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wshihadeh/docker-deployment-action@v2
with:
remote_docker_host: [email protected]
ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }}
ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }}
stack_file_name: deployment/compose-development.yaml
args: up --build --force-recreate --detach
16 changes: 16 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Deploy Production

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wshihadeh/docker-deployment-action@v2
with:
remote_docker_host: [email protected]
ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }}
ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }}
stack_file_name: deployment/compose-production.yaml
args: up --build --force-recreate --detach
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: deploy
name: Deploy Testing

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: wshihadeh/docker-deployment-action@v2
with:
remote_docker_host: [email protected]
ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }}
ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }}
stack_file_name: compose.yaml
stack_file_name: deployment/compose-testing.yaml
args: up --build --force-recreate --detach
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Upgrade pip
run: pip3 install --upgrade pip
Expand All @@ -37,7 +37,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Upgrade pip
run: pip3 install --upgrade pip
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/migrate-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Migrate Development

on:
push:
branches: [ multiple-environments ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wshihadeh/docker-deployment-action@v2
with:
remote_docker_host: [email protected]
ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }}
ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }}
stack_file_name: deployment/compose-development.yaml
args: run webstrom-backend python manage.py migrate --noinput
Empty file.
Empty file.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ db.sqlite3-journal
/media
/protected_media

**/migrations/**
!**/migrations/__init__.py

fixtures/sources
!fixtures/sources/*.py
!fixtures/sources/requirements.txt
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true,
},
"files.associations": {
"compose-*.yaml": "dockercompose"
},
"git.branchProtection": [
"master"
],
"git.branchProtectionPrompt": "alwaysCommitToNewBranch"
}
}
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ RUN pipenv sync --dev --system

COPY . /app

RUN python manage.py restoredb

EXPOSE 8000

ENTRYPOINT [ "daphne", "-b", "0.0.0.0", "-p", "8000", "webstrom.asgi:application" ]
CMD [ "daphne", "-b", "0.0.0.0", "-p", "8000", "webstrom.asgi:application" ]
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ name = "pypi"
[packages]
daphne = "~=4.0.0"
dj-rest-auth = "~=5.0.1"
django = "~=3.2.23"
django = "~=4.2.11"
django-allauth = "~=0.58.2"
django-filter = "~=23.5"
djangorestframework = "~=3.14.0"
drf-writable-nested = "~=0.7.0"
pillow = "~=10.3.0"
psycopg = "~=3.1.18"
python-magic = "~=0.4.27"

[dev-packages]
Expand Down
44 changes: 26 additions & 18 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 105 additions & 0 deletions cms/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Generated by Django 4.2.11 on 2024-04-14 09:24

import base.models
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('sites', '0002_alter_domain_unique'),
]

operations = [
migrations.CreateModel(
name='InfoBanner',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('visible_after', models.DateTimeField(verbose_name='Zobrazuj od')),
('visible_until', models.DateTimeField(verbose_name='Zobrazuj do')),
('message', models.CharField(help_text='Správa sa zobrazí v baneri. Správa musí byť stručná - jedna krátka veta.', max_length=200, verbose_name='správa')),
],
options={
'verbose_name': 'Informácia v pohyblivom baneri',
'verbose_name_plural': 'Informácie v pohyblivom baneri',
},
),
migrations.CreateModel(
name='Logo',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=150, verbose_name='názov loga')),
('disabled', models.BooleanField()),
('image', base.models.RestrictedFileField(upload_to='logo_images/', verbose_name='Logo')),
],
options={
'verbose_name': 'logo',
'verbose_name_plural': 'logá',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='MessageTemplate',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Pomenovanie generickej správy. Slúži pre orientáciu', max_length=50, verbose_name='Názov')),
('message', models.CharField(help_text='Generické správy pre banner a posty', max_length=200, verbose_name='Generická správa')),
('is_active', models.BooleanField(default=True, verbose_name='Aktívna')),
],
options={
'verbose_name': 'Generické správy pre banner a posty',
'verbose_name_plural': 'Generické správy pre banner a posty',
},
),
migrations.CreateModel(
name='Post',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('visible_after', models.DateTimeField(verbose_name='Zobrazuj od')),
('visible_until', models.DateTimeField(verbose_name='Zobrazuj do')),
('caption', models.CharField(max_length=50, verbose_name='nadpis')),
('short_text', models.CharField(help_text='Krátky 1-2 vetový popis.', max_length=200, verbose_name='krátky text')),
('details', models.TextField(blank=True, help_text='Dlhší text, ktorý sa zobrazí po rozkliknutí.', verbose_name='podrobnosti k príspevku')),
('added_at', models.DateTimeField(auto_now_add=True, verbose_name='pridané')),
('sites', models.ManyToManyField(to='sites.site')),
],
options={
'verbose_name': 'príspevok',
'verbose_name_plural': 'príspevky',
'ordering': ['-added_at'],
},
),
migrations.CreateModel(
name='PostLink',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('caption', models.CharField(help_text='Nápis, ktorý po kliknutí presmeruje na link. Maximálne 2 slová.', max_length=25, verbose_name='názov')),
('url', models.CharField(help_text='URL stránky kam má preklik viesť', max_length=100, verbose_name='URL')),
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='links', to='cms.post', verbose_name='Relevantný príspevok')),
],
options={
'verbose_name': 'link k príspevku',
'verbose_name_plural': 'linky k príspevkom',
},
),
migrations.CreateModel(
name='MenuItem',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('caption', models.CharField(help_text='Nápis, ktorý sa zobrazí v menu. Maximálne 2 slová.', max_length=25, verbose_name='názov')),
('url', models.CharField(help_text='URL stránky kam má preklik viesť', max_length=100, verbose_name='URL')),
('priority', models.SmallIntegerField(help_text='Priorita, čím väčšie, tým vyššie v menu.', verbose_name='priorita')),
('in_footer', models.BooleanField(default=False, verbose_name='Je v pätičke')),
('in_menu', models.BooleanField(default=True, verbose_name='Je v menu')),
('sites', models.ManyToManyField(to='sites.site')),
],
options={
'verbose_name': 'položka v menu',
'verbose_name_plural': 'položky v menu',
'ordering': ['-priority'],
},
),
]
38 changes: 38 additions & 0 deletions cms/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.2.11 on 2024-04-14 09:24

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('flatpages', '0001_initial'),
('cms', '0001_initial'),
('competition', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='infobanner',
name='event',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='competition.event'),
),
migrations.AddField(
model_name='infobanner',
name='message_template',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='cms.messagetemplate'),
),
migrations.AddField(
model_name='infobanner',
name='page',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='flatpages.flatpage'),
),
migrations.AddField(
model_name='infobanner',
name='series',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='competition.series'),
),
]
Loading

0 comments on commit 31dd52f

Please sign in to comment.