diff --git a/compose/README.md b/compose/README.md index afecdb9..e0bd916 100644 --- a/compose/README.md +++ b/compose/README.md @@ -114,7 +114,6 @@ tn-manage createsuperuser # `tn-manage` is the alias for `docker exec -it rs-lnd ``` docker compose -p lndtest --env-file env/stack-lndtn.env build docker compose -p lndtest --env-file env/stack-lndtn.env up -d -docker exec -it rs-lndtn cp -R frontend/static/frontend /usr/src/static docker exec -it rs-lndtn python3 manage.py createsuperuser docker compose -p lndtest --env-file env/stack-lndtn.env restart ``` diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 6d0c02f..52a8081 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -27,14 +27,12 @@ services: - ${BITCOIN_CONF:?}:${GUEST_BITCOIN:?}/bitcoin.conf daphne: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: daphne${SUFFIX} restart: always network_mode: service:tor env_file: - ${ROBOSATS_ENVS_FILE} - environment: - SKIP_COLLECT_STATIC: "true" depends_on: - robosats command: daphne -b 0.0.0.0 -p 9000 robosats.asgi:application @@ -48,7 +46,7 @@ services: network_mode: service:tor robosats: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: rs${SUFFIX} restart: always environment: @@ -57,8 +55,6 @@ services: - ${ROBOSATS_ENVS_FILE} depends_on: - redis - volumes: - - ${STATIC}:/usr/src/static network_mode: service:tor command: gunicorn --bind :8000 --max-requests 1000 --max-requests-jitter 200 -w ${GUNICORN_WORKERS} robosats.wsgi:application @@ -75,69 +71,58 @@ services: - ${DATABASE}:/var/lib/postgresql/data nginx: - image: nginx:${NGINX_TAG:-1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d} + build: ./nginx container_name: nginx${SUFFIX} restart: always volumes: - - ${STATIC}:/usr/src/static:ro - ${NGINX_CONFD}:/etc/nginx/conf.d:ro - ${WELLKNOWN}:/usr/src/.well-known:ro network_mode: service:tor clean-orders: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} restart: always container_name: clord${SUFFIX} command: python3 manage.py clean_orders - environment: - SKIP_COLLECT_STATIC: "true" env_file: - ${ROBOSATS_ENVS_FILE} network_mode: service:tor follow-invoices: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: invo${SUFFIX} restart: always env_file: - ${ROBOSATS_ENVS_FILE} - environment: - SKIP_COLLECT_STATIC: "true" command: python3 manage.py follow_invoices network_mode: service:tor telegram-watcher: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: tg${SUFFIX} restart: always - environment: - SKIP_COLLECT_STATIC: "true" env_file: - ${ROBOSATS_ENVS_FILE} command: python3 manage.py telegram_watcher network_mode: service:tor celery: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: cele${SUFFIX} restart: always env_file: - ${ROBOSATS_ENVS_FILE} - environment: - SKIP_COLLECT_STATIC: "true" command: celery -A robosats worker --loglevel=WARNING depends_on: - redis network_mode: service:tor celery-beat: - image: recksato/robosats:${ROBOSATS_TAG:-v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1} + image: recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} container_name: beat${SUFFIX} restart: always env_file: - ${ROBOSATS_ENVS_FILE} - environment: - SKIP_COLLECT_STATIC: "true" command: celery -A robosats beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler depends_on: - redis @@ -180,7 +165,6 @@ services: - ${LND_DATA}:/running/lnd:ro - ${LND_CONF}:/running/lnd/lnd.conf:ro - ${LIT_DATA}:/running/lit:ro - - ${STATIC}:/running/static:ro - ${BU_DIR1}:/backup1:rw - ${BU_DIR2}:/backup2:rw - ${BU_DIR3}:/backup3:rw diff --git a/compose/env-sample/clntn/compose.env b/compose/env-sample/clntn/compose.env index 9ab2902..5e0ae9a 100644 --- a/compose/env-sample/clntn/compose.env +++ b/compose/env-sample/clntn/compose.env @@ -1,12 +1,11 @@ # Uncomment the dockerhub tags to override the image versions localy without need to fork the docker-compose.yml -# ROBOSATS_TAG='v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1' +# ROBOSATS_TAG='v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f' # BITCOIND_TAG='24.0.1-alpine@sha256:624b6fb1c282a3db6438ff35fbb9eed6ae260c66ffbb427ae72edd7da6a0ecdc' # REDIS_TAG='7.2.1-alpine@sha256:7f5a0dfbf379db69dc78434091dce3220e251022e71dcdf36207928cbf9010de' # NGINX_TAG='1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d' # POSTGRES_TAG='14.2-alpine@sha256:2fb5718f2a23dbac9bd1258e886eee90250a5903785e3136d62dd65e19f34982' -STATIC='/custom_path/testnet/static' DATABASE='/custom_path/testnet/database' # You can create a cronjob to create PG backups diff --git a/compose/env-sample/lndtn/compose.env b/compose/env-sample/lndtn/compose.env index 752fb42..c663ffe 100644 --- a/compose/env-sample/lndtn/compose.env +++ b/compose/env-sample/lndtn/compose.env @@ -1,6 +1,6 @@ # Uncomment the dockerhub tags to override the image versions localy without need to fork the docker-compose.yml -# ROBOSATS_TAG='v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1' +# ROBOSATS_TAG='v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f' # BITCOIND_TAG='24.0.1-alpine@sha256:624b6fb1c282a3db6438ff35fbb9eed6ae260c66ffbb427ae72edd7da6a0ecdc' # REDIS_TAG='7.2.1-alpine@sha256:7f5a0dfbf379db69dc78434091dce3220e251022e71dcdf36207928cbf9010de' # NGINX_TAG='1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d' @@ -10,7 +10,6 @@ # THUNDERHUB_TAG='v0.13.23@sha256:5ad834045dc3030ec199615827c415ca07729da32c4739afd3adfc662af4fe65' # LIT_TAG='v0.11.0-alpha@sha256:dc14c495f699b14c2d75c43097ad3ab40e7287fc136a3203df9cffe17b867b71' -STATIC='/custom_path/testnet/static' DATABASE='/custom_path/testnet/database' # You can create a cronjob to create PG backups diff --git a/compose/nginx/Dockerfile b/compose/nginx/Dockerfile new file mode 100644 index 0000000..e9f5b3b --- /dev/null +++ b/compose/nginx/Dockerfile @@ -0,0 +1,5 @@ +FROM recksato/robosats:${ROBOSATS_TAG:-v0.8.4-alpha@sha256:e47f1225260d2508d4501af237714574dd467da4f735b6dce19d88bab41e744f} AS robosats + +FROM nginx:${NGINX_TAG:-1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d} AS nginx + +COPY --from=robosats /usr/src/static /usr/src/static \ No newline at end of file diff --git a/compose/nginx/mn.conf.d/local.conf b/compose/nginx/mn.conf.d/local.conf index d1c4852..0f60a85 100644 --- a/compose/nginx/mn.conf.d/local.conf +++ b/compose/nginx/mn.conf.d/local.conf @@ -26,6 +26,9 @@ server { server_name robosats.com; large_client_header_buffers 4 64k; + gzip_static on; + gzip_proxied expired no-cache no-store private auth; + location /static { alias /usr/src/static; } diff --git a/compose/nginx/tn.conf.d/local.conf b/compose/nginx/tn.conf.d/local.conf index 03ef084..6d08530 100644 --- a/compose/nginx/tn.conf.d/local.conf +++ b/compose/nginx/tn.conf.d/local.conf @@ -26,6 +26,9 @@ server { server_name satstralia.com; large_client_header_buffers 4 64k; + gzip_static on; + gzip_proxied expired no-cache no-store private auth; + location /static { alias /usr/src/static; } diff --git a/k8s/README.md b/k8s/README.md index c6c2708..13684fa 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -144,7 +144,6 @@ kubectl exec -it -n testnet -- bash python3 manage.py makemigrations control api chat python3 manage.py migrate python3 manage.py createsuperuser -python3 manage.py collectstatic ``` Warning django webserver will start up faster than postgres. Needs to be staged. diff --git a/k8s/base/daphne/deployment.yml b/k8s/base/daphne/deployment.yml index aee4d94..df49398 100644 --- a/k8s/base/daphne/deployment.yml +++ b/k8s/base/daphne/deployment.yml @@ -38,14 +38,9 @@ spec: ports: - containerPort: 9000 volumeMounts: - - name: static-data - mountPath: /usr/src/static - name: lnd-data mountPath: /lnd volumes: - - name: static-data - persistentVolumeClaim: - claimName: static-pvc - name: lnd-data persistentVolumeClaim: claimName: lnd-pvc \ No newline at end of file diff --git a/k8s/base/gunicorn/deployment.yml b/k8s/base/gunicorn/deployment.yml index 3eba338..bb566ef 100644 --- a/k8s/base/gunicorn/deployment.yml +++ b/k8s/base/gunicorn/deployment.yml @@ -38,14 +38,8 @@ spec: ports: - containerPort: 8000 volumeMounts: - - name: static-data - mountPath: /usr/src/static - name: lnd-data mountPath: /lnd - volumes: - - name: static-data - persistentVolumeClaim: - claimName: static-pvc - name: lnd-data persistentVolumeClaim: claimName: lnd-pvc \ No newline at end of file diff --git a/k8s/base/kustomization.yml b/k8s/base/kustomization.yml index 4e6ae9a..0389650 100644 --- a/k8s/base/kustomization.yml +++ b/k8s/base/kustomization.yml @@ -33,7 +33,6 @@ resources: - celery/worker-deployment.yml - celery/beat-deployment.yml # Nginx - - nginx/static-pvc.yml - nginx/configmap.yml - nginx/service.yml - nginx/deployment.yml diff --git a/k8s/base/nginx/deployment.yml b/k8s/base/nginx/deployment.yml index 75576d7..dce9561 100644 --- a/k8s/base/nginx/deployment.yml +++ b/k8s/base/nginx/deployment.yml @@ -29,8 +29,6 @@ spec: cpu: "1m" memory: "5Mi" volumeMounts: - - name: static-data - mountPath: /usr/src/static readOnly: true - name: nginx-conf mountPath: /etc/nginx/conf.d/local.conf @@ -38,10 +36,6 @@ spec: - name: nginx-conf mountPath: /etc/nginx/nginx.conf subPath: nginx.conf - volumes: - - name: static-data - persistentVolumeClaim: - claimName: static-pvc - name: nginx-conf configMap: name: nginx-configmap \ No newline at end of file diff --git a/k8s/base/nginx/static-pvc.yml b/k8s/base/nginx/static-pvc.yml deleted file mode 100644 index d23d339..0000000 --- a/k8s/base/nginx/static-pvc.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim # Create PVC -metadata: - name: static-pvc # Sets name of PV - labels: - app: static # Defines app to create PVC for -spec: - storageClassName: openebs-host - accessModes: - - ReadWriteOnce # Sets read and write access - resources: - requests: - storage: 2Gi # Sets PVC's size \ No newline at end of file diff --git a/web/custom_nginx.conf b/web/custom_nginx.conf index 6aa227d..a8f91c6 100644 --- a/web/custom_nginx.conf +++ b/web/custom_nginx.conf @@ -26,6 +26,9 @@ http { sendfile on; keepalive_timeout 65; + gzip_static on; + gzip_proxied expired no-cache no-store private auth; + server { listen 80;