Chore: Updated python dependencies

Chore: Updated angular to v19
Chore: Refactored ops with docker and ansible
This commit is contained in:
2024-12-16 17:53:21 +05:30
parent 010e9a84db
commit 2495c24e1a
127 changed files with 9712 additions and 416 deletions

18
ansible/files/.env Normal file
View File

@ -0,0 +1,18 @@
HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/petty{{ name }}
MODULE_NAME=barker.main
PROJECT_NAME=barker
MAX_WORKERS=4
REDIS_HOST=redis
REDIS_PORT=6379
SECRET_KEY={{ secret_key }}
MIDDLEWARE_SECRET_KEY={{ middleware_key }}
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
NEW_DAY_OFFSET_MINUTES=420
TIMEZONE_OFFSET_MINUTES=330
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

1
ansible/files/build-frank.sh Executable file
View File

@ -0,0 +1 @@
docker build --file /home/{{ user }}/dockerfile/app/frank.Dockerfile --tag frank:latest /home/{{ user }}/dockerfile/app

4
ansible/files/config Normal file
View File

@ -0,0 +1,4 @@
Host rohan rohan.tanshu.com
HostName rohan.tanshu.com
IdentityFile ~/.ssh/id_ed25519
User tanshu

3
ansible/files/frank.env Normal file
View File

@ -0,0 +1,3 @@
REDIS_HOST=localhost
REDIS_PORT=6379
QUEUE_NAME={{ queue_name }}

View File

@ -0,0 +1,15 @@
[Unit]
Description=Frank container service
After=docker.service rohan-redis-tunnel.service
Wants=network-online.target docker.socket rohan-redis-tunnel.service
Requires=docker.socket rohan-redis-tunnel.service
PartOf=rohan-redis-tunnel.service
[Service]
Restart=always
RestartSec=3
ExecStart=/usr/bin/docker start -a frank
ExecStop=/usr/bin/docker stop -t 10 frank
[Install]
WantedBy=multi-user.target

1
ansible/files/frank.sh Normal file
View File

@ -0,0 +1 @@
docker run --detach --name frank --env-file=/home/{{ user }}/frank.env --network=host --restart=no --device /dev/usb/lp0:/printer frank:latest

View File

@ -0,0 +1,16 @@
[Unit]
Description=Reverse SSH connection
After=network.target
[Service]
Type=simple
User={{ user }}
ExecStart=/usr/bin/ssh -NTg -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o ServerAliveCountMax=3 -o StrictHostKeyChecking=no -i /home/{{ user }}/.ssh/id_ed25519 -R {{ ssh_port }}:localhost:22 tanshu@rohan.tanshu.com
# Restart every >2 seconds to avoid StartLimitInterval failure
Restart=always
RestartSec=5s
[Install]
WantedBy=default.target

View File

@ -0,0 +1,39 @@
server {
listen 80;
server_name {{ http_host }};
# Allow large attachments
client_max_body_size 128M;
location /api {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://localhost:{{ host_port }};
}
location /token {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://localhost:{{ host_port }};
}
location /refresh {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://localhost:{{ host_port }};
}
location /db-image {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://localhost:{{ host_port }};
}
location / {
root /var/lib/{{ host_directory }}/frontend;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}

View File

@ -0,0 +1,15 @@
[Unit]
Description=Keep ssh tunnel to specified remote host open
After=network.target
[Service]
User={{ user }}
ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes -o ServerAliveCountMax=2 -o StrictHostKeyChecking=no -i /home/{{ user }}/.ssh/id_ed25519 -L 6379:localhost:6379 tanshu@rohan.tanshu.com
# Restart every >2 seconds to avoid StartLimitInterval failure
RestartSec=5
Restart=always
[Install]
WantedBy=multi-user.target