Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Python code checks and changes in Nginx config directory #23

Merged
merged 8 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/python-code-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Python code checks
on: pull_request
jobs:
bandit:
runs-on: ubuntu-20.04
steps:
- uses: jpetrucciani/bandit-check@main
with:
path: "."
black:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.11.6
- run: |
python -m pip install --upgrade pip
pip install black==22.12.0
- run: |
black --check --line-length=79 --verbose .
flake8:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.11.6
- run: |
python -m pip install --upgrade pip
pip install flake8==5.0.4
- run: |
flake8 --verbose .
isort:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.11.6
- run: |
python -m pip install --upgrade pip
pip install isort==5.11.4
- run: |
isort --profile black --check-only .
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ RUN python manage.py collectstatic --no-input

EXPOSE 8001

CMD gunicorn -w 2 -b 0.0.0.0:8001 --chdir /opt/code wsgi:application --reload --timeout 900
CMD gunicorn -w 2 -b 0.0.0.0:8008 --chdir /opt/code wsgi:application --reload --timeout 900
23 changes: 23 additions & 0 deletions config/nginx/conf.d/local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
upstream webserver {
server hls_backend:8008;
}


server {
listen 80;
server_name localhost;

client_max_body_size 20M;

location / {
proxy_pass http://webserver;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}

location /static/ {
alias /opt/code/static/;
}

}
28 changes: 26 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
---
version: "3"
services:
health-level-seven:
hls_backend:
build: .
container_name: hls_backend
restart: always
ports:
- 8001:8001
- 8008:8008
networks:
- hls_network
hls_webserver:
image: nginx:1.13
container_name: hls_webserver
restart: always
ports:
- 8001:80
volumes:
- ./config/nginx/conf.d:/etc/nginx/conf.d
- ./static:/opt/code/static
depends_on:
- hls_backend
networks:
- hls_network

networks:
hls_network:
driver: bridge

volumes:
static_volume:

2 changes: 1 addition & 1 deletion src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
).split(",")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = (os.environ.get('DEBUG') or 'false') == 'true'

# Application definition

Expand Down
Loading