-
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
Showing
15 changed files
with
198 additions
and
25 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
**/.env | ||
**/node_modules/ | ||
**/__pycache__ | ||
**/venv | ||
**/.venv | ||
|
||
# Logs | ||
logs | ||
|
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 @@ | ||
.venv |
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 @@ | ||
from backend.settings.common import * |
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,3 @@ | ||
from backend.settings.common import * | ||
|
||
DEBUG = False |
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
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,91 @@ | ||
aiohttp==3.8.3 | ||
aiosignal==1.2.0 | ||
asgiref==3.5.2 | ||
async-timeout==4.0.2 | ||
attrs==19.3.0 | ||
Automat==0.8.0 | ||
blinker==1.4 | ||
certifi==2019.11.28 | ||
cffi==1.15.1 | ||
chardet==3.0.4 | ||
charset-normalizer==2.1.1 | ||
Click==7.0 | ||
colorama==0.4.3 | ||
configobj==5.0.6 | ||
constantly==15.1.0 | ||
cryptography==2.8 | ||
dateparser==1.1.1 | ||
distro==1.4.0 | ||
Django==4.1.10 | ||
django-cors-headers==4.2.0 | ||
django-multitenant==3.2.1 | ||
djangorestframework==3.14.0 | ||
djangorestframework-jwt==1.11.0 | ||
djangorestframework-simplejwt==5.2.2 | ||
entrypoints==0.3 | ||
frozenlist==1.3.1 | ||
gevent==22.10.1 | ||
greenlet==1.1.3 | ||
gunicorn==20.1.0 | ||
httplib2==0.14.0 | ||
hyperlink==19.0.0 | ||
idna==2.8 | ||
importlib-metadata==1.5.0 | ||
incremental==16.10.1 | ||
Jinja2==2.10.1 | ||
jsonpatch==1.22 | ||
jsonpointer==2.0 | ||
jsonschema==3.2.0 | ||
keyring==18.0.1 | ||
launchpadlib==1.11.0 | ||
lazr.restfulclient==0.14.2 | ||
lazr.uri==1.0.3 | ||
MarkupSafe==1.1.0 | ||
more-itertools==4.2.0 | ||
multidict==6.0.2 | ||
netifaces==0.10.4 | ||
numpy==1.23.3 | ||
oauthlib==3.1.0 | ||
pandas==1.5.0 | ||
pbr==5.10.0 | ||
pexpect==4.6.0 | ||
psycopg2-binary==2.9.7 | ||
ptyprocess==0.7.0 | ||
pyasn1==0.4.2 | ||
pyasn1-modules==0.2.1 | ||
pycparser==2.21 | ||
PyHamcrest==1.9.0 | ||
pyinotify==0.9.6 | ||
PyJWT==1.7.1 | ||
pymacaroons==0.13.0 | ||
PyNaCl==1.3.0 | ||
pyOpenSSL==19.0.0 | ||
pyrsistent==0.15.5 | ||
pyserial==3.4 | ||
python-binance==1.0.16 | ||
python-dateutil==2.8.2 | ||
python-decouple==3.6 | ||
pytz==2022.4 | ||
pytz-deprecation-shim==0.1.0.post0 | ||
PyYAML==5.3.1 | ||
regex==2022.3.2 | ||
requests==2.22.0 | ||
requests-unixsocket==0.2.0 | ||
SecretStorage==2.3.1 | ||
service-identity==18.1.0 | ||
simplejson==3.16.0 | ||
six==1.14.0 | ||
sqlparse==0.4.2 | ||
ssh-import-id==5.10 | ||
testresources==2.0.1 | ||
Twisted==21.2.0 | ||
tzdata==2022.4 | ||
tzlocal==4.2 | ||
ujson==5.5.0 | ||
urllib3==1.25.8 | ||
wadllib==1.3.3 | ||
websockets==10.3 | ||
yarl==1.8.1 | ||
zipp==1.0.0 | ||
zope.event==4.5.0 | ||
zope.interface==5.4.0 |
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,32 +1,58 @@ | ||
version: "3" | ||
services: | ||
robsondb: | ||
container_name: robsonDatabase | ||
image: citusdata/citus | ||
environment: | ||
POSTGRES_USER: 'postgres' | ||
POSTGRES_PASSWORD: 'mypass' | ||
POSTGRES_DB: 'postgres' | ||
# volumes: | ||
# - pgdata:${PG_DATA} | ||
ports: | ||
- 5450:5432 | ||
restart: always | ||
|
||
# cronjob: | ||
# container_name: dump | ||
# build: ./dump | ||
# environment: | ||
# PG_HOST: ${PG_HOST} | ||
# POSTGRES_USER: ${PG_USER} | ||
# POSTGRES_PASSWORD: ${PG_PASSWORD} | ||
# POSTGRES_DB: ${PG_DATABASE} | ||
# PGDATA: ${PG_DATA} | ||
# PGPORT: ${PG_PORT} | ||
# restart: always | ||
|
||
backend-monolith: | ||
container_name: RbsBackendMonolith | ||
container_name: backendMonolith | ||
image: backend-monolith | ||
build: ./backends/monolith | ||
volumes: | ||
- ./backends/monolith:/app-backend | ||
restart: always | ||
|
||
frontend-web: | ||
container_name: RbsFrontendWeb | ||
container_name: frontendWeb | ||
image: frontend-web | ||
build: ./frontends/web | ||
ports: | ||
- 3403:3403 | ||
volumes: | ||
- ./frontends/web:/app-frontend | ||
ports: | ||
- 3403:3403 | ||
depends_on: | ||
- backend-monolith | ||
restart: always | ||
|
||
nginx_backend_server: | ||
container_name: rbs_nginx_backend_server | ||
image: rbs_nginx_backend_server_img | ||
depends_on: | ||
- backend-monolith | ||
container_name: nginxMonolith | ||
build: ./backends/nginx_monolith | ||
ports: | ||
- 8403:8403 | ||
depends_on: | ||
- backend-monolith | ||
restart: always | ||
|
||
volumes: | ||
pgdata: |
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,10 @@ | ||
FROM ubuntu:latest | ||
RUN apt-get update; apt-get install -y postgresql-client python3 python3-pip | ||
WORKDIR /app | ||
ENV TZ=America/Sao_Paulo | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
RUN pip3 install rocketry | ||
COPY ./rocketry/main.py /app/rocketry/main.py | ||
COPY ./rocketry/dump.sh /app/rocketry/dump.sh | ||
COPY ./rocketry/backup.sh /app/rocketry/backup.sh | ||
CMD ["python3", "/app/rocketry/main.py"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
filepath=/app/$(date +%F_%H-%M-%S).sql | ||
pg_dump -Fc --host=$PG_HOST --port=$PG_PORT --username=$PG_USER --password=$PG_PASSWORD --dbname=$PG_DBNAME -f filename | ||
cp $filepath /app/pg-dump.sql |
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,30 @@ | ||
from rocketry import Rocketry | ||
from rocketry.conds import after_success, after_fail, after_finish | ||
from rocketry.log import MinimalRecord | ||
from redbird.repos import CSVFileRepo | ||
import subprocess | ||
|
||
repo = CSVFileRepo(filename="tasks.csv", model=MinimalRecord) | ||
|
||
app = Rocketry(logger_repo=repo) | ||
|
||
@app.task('daily') | ||
def job(): | ||
print ("Running a cronjob...") | ||
subprocess.call(['sh', '/app/rocketry/dump.sh']) | ||
return(True) | ||
|
||
@app.task(after_success(job)) | ||
def do_after_success(): | ||
print ("Trying to backup...") | ||
subprocess.call(['sh', '/app/rocketry/backup.sh']) | ||
|
||
@app.task(after_fail(job)) | ||
def do_after_fail(): | ||
print(False) | ||
|
||
@app.task(after_finish(job)) | ||
def do_after_fail_or_success(): | ||
print ("Backup done") | ||
|
||
app.run() |