Skip to content

Commit

Permalink
Merge pull request #2 from ijdigital/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dulvui authored Nov 4, 2024
2 parents a8677da + 29a12ac commit 3c72492
Show file tree
Hide file tree
Showing 107 changed files with 15,001 additions and 3,380 deletions.
1 change: 1 addition & 0 deletions .env.docker.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB_HOST=host.docker.internal
16 changes: 5 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
DB_HOST=localhost
DB_HOST=localhost #host.docker.internal
DB_USERNAME=sfscon
DB_PASSWORD=sfscon
DB_NAME=sfscon
DB_PORT=5432

PRETIX_TOKEN=__PLACE_YOUR_PRETIX_TOKEN__
PRETIX_CHECKLIST_ID=__PLACE_CHECKLIST_ID__
PRETIX_EVENT_ID=__PLACE_EVENT_ID__
PRETIX_ORGANIZER_ID=noi-digital

JWT_SECRET_KEY=__SET_ANYTHING_FOR_ENCODING_JWT__

XML_URL="https://www.sfscon.it/?calendar=2023&format=xml"
XML_URL="https://www.sfscon.it/?calendar=2024&format=xml"

REDIS_SERVER=localhost
REDIS_SERVER=redis

ADMIN_USERNAME=__ADMIN_USERNAME__
ADMIN_PASSWORD=__ADMIN_PLAINTEXT_PASSWORD__
LANE_USERNAME_PREFIX=__ADMIN_USERNAME__
ADMIN_USERNAME=admin
ADMIN_PASSWORD=123
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
aliases.sh
.mypy_cache
.env
.env.docker
*.pyc
.venv
.idea
Expand All @@ -8,3 +10,4 @@ __pycache__
.pytest_cache
TODO.txt
restore/
aws.credentials
12 changes: 0 additions & 12 deletions .reuse/dep5

This file was deleted.

31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# opencon

###


### Requirements

Expand All @@ -11,26 +13,38 @@ app
- docker compose
- postgresql 14+

### Changes introduced/removed in this release:

- Added anonymous users
- Removed Pretixx integration
- Removed access control module

### Installation

- checkout this repository
- run docker compose build
- setup .env file (from .env.sample)
- setup .env file (from .env.example)
- setup .env.docker from .env.docker.example (this file contains different database location, by default, but anything else can be overridden)
- setup global nginx (see configuration file in config/nginx.global.conf.sample
- run docker compose build
- run docker compose up -d

currently and by default, the database has been setup on host machine
visible from docker containers on host.docker.internal

this is defined at the top of .env file as
this is defined at the top of .env and .env.docker files as

```
DB_HOST=host.docker.internal
DB_HOST=localhost
DB_USERNAME=opencon_user # or any other your username
DB_PASSWORD=__your_password__
DB_NAME=opencon_db # or any other database name
DB_PORT=5432
```
and
```
DB_HOST=host.docker.internal
```

create database __db_name__ with read/write/create_tables privilege for
__your_user__
Expand All @@ -48,7 +62,7 @@ psql -U opencon_user template1
create database opencon_db
```

### bootstrap
### Bootstrap

- run docker compose up -d

Expand All @@ -60,3 +74,12 @@ ADMIN_PASSWORD=__your_admin_password__

click to sync button to sync initial content from sfscon.it

### Program Data

When the project is started, the database is empty. The program will automatically create the necessary tables.

Conference data is pulled from the sfscon.it API via crontab in the conferences container every 5 minutes.

Therefore, the content will be available to users within 5 minutes or on request through the admin panel.


16 changes: 16 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version = 1
SPDX-PackageName = "OpenCON"
SPDX-PackageSupplier = "DigitalCUBE <info@digitalcube.rs>"
SPDX-PackageDownloadLocation = "https://m.opencon.dev/"

[[annotations]]
path = ["src/scripts/update-conf.py", "aws.credentials.example",".env.docker.example", "start.sh", "src/tests/**", "src/shared/**", "config/**", "REUSE.toml", "static/**", ".gitignore", "**.sample", ".env.sample", "docker-compose.yaml", "src/**.yaml", "src/**.xml", "src/docker/**", "README.md", "requirements.txt", "src/pyproject.toml", "src/tests/assets/fake_attendees.json", "src/tests/pytest.ini", "src/migrations/models/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2023 DigitalCUBE <info@digitalcube.rs>"
SPDX-License-Identifier = "GPL-3.0-or-later"

[[annotations]]
path = [".github/**", "infrastructure/**", ".gitignore", ".env.example", "calls.http"]
precedence = "aggregate"
SPDX-FileCopyrightText = "(c) NOI Techpark <digital@noi.bz.it>"
SPDX-License-Identifier = "CC0-1.0"
4 changes: 4 additions & 0 deletions aws.credentials.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[default]
aws_access_key_id=__KEY_ID__
aws_secret_access_key=__ACCESS_KEY__
region=eu-central-1
37 changes: 37 additions & 0 deletions config/nginx.admin.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

upstream upstream_conferences { ip_hash; server conferences:8000 max_fails=3 fail_timeout=300s; }


server {
root /web/admin;

listen 80 default;
server_name _;

client_max_body_size 20M;

location / {
index index.html;
try_files $uri $uri/ /index.html;
}

location /api {
proxy_pass http://upstream_conferences;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;
}


proxy_buffering off;

rewrite ^/api/(.*)$ /api/$1 break;
rewrite ^/(.*)$ /$1 break;

}
54 changes: 13 additions & 41 deletions config/nginx.admin.config.sample
Original file line number Diff line number Diff line change
@@ -1,69 +1,41 @@

upstream oneservices_v2 { ip_hash; server 127.0.0.1:8000 max_fails=3 fail_timeout=300s; }
upstream upstream_conferences { ip_hash; server conferences:8000 max_fails=3 fail_timeout=300s; }


server {
root /home/digital/app/frontend;
root /web/admin;

server_name webadmin.app.sfscon.testingmachine.eu app.sfscon.it;

client_max_body_size 20M;

location / {
index index.html;
try_files $uri $uri/ /index.html;
}

location /static {
root /home/digital/app/impresaone;
}

location /pretix {
proxy_pass http://apilogger; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;

}

location /api/v3 {
proxy_pass http://oneservices_v2; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;
location /static {
root /home/digital/app/impresaone;
}

location /api {
proxy_pass http://oneservices_v2; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
location /api {
proxy_pass http://upstream_conferences;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;
}

location /qr-codes {
root /home/digital/app;
index index.html;
}

proxy_buffering off;

# for sfscon mobile app forgot password
# rewrite ^/forgot-password(.*)$ sfscon://reset-password$1 permanent;
rewrite ^/password-redirect(.*)$ sfscon://reset-password$1 permanent;
# rewrite ^/password-redirect-expo-go(.*)$ sfscon://reset-password$1 permanent;
proxy_buffering off;

rewrite ^/api/v3/(.*)$ /api/v3/$1 break;
rewrite ^/api/(.*)$ /api/$1 break;

rewrite ^/pretix/(.*)$ /pretix/$1 break;
rewrite ^/qr-codes(.*)$ /qr-codes$1 break;
rewrite ^/(.*)$ /$1 break;

listen 80;
listen 80;
}
87 changes: 33 additions & 54 deletions config/nginx.global.config.sample
Original file line number Diff line number Diff line change
@@ -1,58 +1,37 @@
upstream oneservices { ip_hash; server 127.0.0.1:8080 max_fails=3 fail_timeout=300s; }
upstream apilogger { ip_hash; server 127.0.0.1:8888 max_fails=3 fail_timeout=300s; }
upstream ups1 { ip_hash; server localhost:8001 max_fails=3 fail_timeout=600s; }

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 80 default;
root /home/digital/app/frontend/dist;

server_name stage.opencon.dev;

client_max_body_size 20M;

location /static {
root /home/digital/app/impresaone;
}

location / {
index index.html;
try_files $uri $uri/ /index.html;
}

location /pretix {
proxy_pass http://apilogger; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;

}

location /api/v3 {
proxy_pass http://oneservices; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;
}

location /qr-codes {
root /home/digital/app;
index index.html;
# try_files $uri $uri/ index.html;
}

proxy_buffering off;

# for sfscon mobile app forgot password
# rewrite ^/forgot-password(.*)$ sfscon://reset-password$1 permanent;
rewrite ^/password-redirect(.*)$ sfscon://reset-password$1 permanent;
# rewrite ^/password-redirect-expo-go(.*)$ sfscon://reset-password$1 permanent;

rewrite ^/api/v3/(.*)$ /api/v3/$1 break;
rewrite ^/pretix/(.*)$ /pretix/$1 break;
rewrite ^/qr-codes(.*)$ /qr-codes$1 break;
rewrite ^/(.*)$ /$1 break;
listen 80;

index index.html;

server_name dev.opencon.dev;

client_max_body_size 100M;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;

location / {
proxy_pass http://ups1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 3600s;
proxy_set_header X-Forwarded-Proto $scheme;
}

proxy_buffering off;
}

Loading

0 comments on commit 3c72492

Please sign in to comment.