Using PVC instead, updated celery

This commit is contained in:
斟酌 鵬兄 2022-03-16 01:04:16 +09:00
parent a95c849f79
commit 923dfc5ba1
4 changed files with 53 additions and 20 deletions

View File

@ -6,6 +6,7 @@
*.pyc *.pyc
Dockerfile Dockerfile
k8s.yaml k8s.yaml
cache/
windows/* windows/*
__pycache__ __pycache__
cache/* cache/*

View File

@ -7,7 +7,7 @@ RUN wget -O /opt/utils/yuicompressor.jar "https://github.com/tgckpg/BotanJS/rele
RUN apk add --update bash python3 uwsgi uwsgi-python openjdk11-jre-headless; python3 -m ensurepip RUN apk add --update bash python3 uwsgi uwsgi-python openjdk11-jre-headless; python3 -m ensurepip
RUN echo "www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin" >> /etc/passwd; echo "www-data:x:33:" >> /etc/group RUN echo "www-data:x:1001:1001:www-data:/var/www:/usr/sbin/nologin" >> /etc/passwd; echo "www-data:x:1001:" >> /etc/group
RUN chown www-data:www-data . -R RUN chown www-data:www-data . -R
RUN pip3 install Flask redis compressinja Celery RUN pip3 install Flask redis compressinja Celery

View File

@ -12,17 +12,15 @@ spec:
labels: labels:
app: astrojs app: astrojs
spec: spec:
volumes: securityContext:
- name: astrojs-cache runAsGroup: 1001
nfs: runAsNonRoot: true
server: astrofile.astrohost runAsUser: 1001
path: /srv/astrostorage imagePullSecrets:
- name: registry-auth
containers: containers:
- name: web - name: web
image: 192.168.80.4:32000/sites/astrojs:b00034 image: registry.k8s.astropenguin.net/astrojs:2022.03.15.04
volumeMounts:
- mountPath: "/app/cache"
name: astrojs-cache
env: env:
- name: FLASK_DEBUG - name: FLASK_DEBUG
value: "0" value: "0"
@ -30,16 +28,36 @@ spec:
value: "production" value: "production"
- name: RUN_MODE - name: RUN_MODE
value: "web" value: "web"
volumeMounts:
- name: cache
mountPath: "/app/cache"
- name: redis - name: redis
image: redis:6.0.8-alpine image: redis:6.0.8-alpine
- name: compiler - name: compiler
image: 192.168.80.4:32000/sites/astrojs:b00034 image: registry.k8s.astropenguin.net/astrojs:2022.03.15.04
volumeMounts:
- mountPath: "/app/cache"
name: astrojs-cache
env: env:
- name: RUN_MODE - name: RUN_MODE
value: "tasks" value: "tasks"
volumeMounts:
- name: cache
mountPath: "/app/cache"
volumes:
- name: cache
persistentVolumeClaim:
claimName: astrojs-cache
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: astrojs-cache
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
storageClassName: local-storage
--- ---
@ -60,16 +78,32 @@ apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: astrojs name: astrojs
namespace: ingress-https
spec: spec:
ingressClassName: nginx ingressClassName: nginx
tls:
- hosts:
- astrojs.k8s.astropenguin.net
secretName: any-k8s-astro-prod
rules: rules:
- host: botanjs.astropenguin.net - host: astrojs.k8s.astropenguin.net
http: http:
paths: paths:
- path: / - path: /
pathType: Prefix pathType: Prefix
backend: backend:
service: service:
name: astrojs name: f-astrojs-default
port: port:
number: 5000 number: 5000
---
kind: Service
apiVersion: v1
metadata:
name: f-astrojs-default
namespace: ingress-https
spec:
type: ExternalName
externalName: astrojs.default.svc.cluster.local

View File

@ -19,11 +19,9 @@ case "$RUN_MODE" in
"tasks") "tasks")
source "$INST_DIR/celery.conf" source "$INST_DIR/celery.conf"
celery worker -n worker1@%h \ celery -A ${CELERY_APP} worker -n worker1@%h \
-A ${CELERY_APP} \
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} \ --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} \
& celery worker -n worker1@%h \ & celery -A ${CELERY_APP} worker -n worker1@%h \
-A ${CELERY_APP} \
--loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
;; ;;
*) *)