Skip to content

Commit

Permalink
Merge pull request #19 from GESIS-Methods-Hub/collect-static-files
Browse files Browse the repository at this point in the history
Collect static files
  • Loading branch information
rgaiacs authored Aug 4, 2023
2 parents eb430e0 + d58ee18 commit a007977
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
5 changes: 5 additions & 0 deletions andrew/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@

STATIC_URL = "static/"

STATIC_ROOT = os.getenv(
"STATIC_ROOT",
"/var/andrew-django-admin/static"
)

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

Expand Down
5 changes: 5 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Apply database migrations
python3 manage.py migrate

# Collect static files
python3 manage.py collectstatic \
--no-input \
--no-post-process

if [[ -z "$@" ]]
then
echo "Docker CMD is empty. Please provide one."
Expand Down
4 changes: 2 additions & 2 deletions helm/andrew-django-admin/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.6
version: 0.2.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.6"
appVersion: "0.2.7"
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ spec:
secretKeyRef:
name: {{ .Chart.Name }}-postgres
key: db
volumeMounts:
- mountPath: "/var/andrew-django-admin/static"
name: {{ .Chart.Name }}-pv-storage
volumes:
- name: {{ .Chart.Name }}-pv-storage
persistentVolumeClaim:
claimName: {{ .Chart.Name }}-pv-claim
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Chart.Name }}-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: {{ .Values.host_static_files_dir | quote }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Chart.Name }}-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
1 change: 1 addition & 0 deletions helm/andrew-django-admin/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
debug: true
host: "*"
log_level: "WARNING"
host_static_files_dir: "/var/www/"

0 comments on commit a007977

Please sign in to comment.