generated from n1rjal/djate
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
52 lines (41 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
SOPS_AGE_KEY_FILE=.age/key.txt
init:
pip freeze | grep poetry || pip install poetry
# Activate poetry shell
poetry install || echo "Poetry environment not found."
# make reqyured directory
mkdir staticfiles logs
touch logs/django_error.log
# Copy environment files
cp env.example .env && cp env.example docker.env
create_admin:
DJANGO_SUPERUSER_USERNAME=$(DJANGO_ADMIN_USERNAME) \
DJANGO_SUPERUSER_EMAIL=$(DJANGO_ADMIN_EMAIL) \
DJANGO_SUPERUSER_PASSWORD=$(DJANGO_ADMIN_PASSWORD) \
python manage.py createsuperuser --noinput || echo "Superuser creation failed." && echo "Super user $(DJANGO_ADMIN_USERNAME) created successfully"
build_dev:
docker buildx build --target development -t gnome_nepal:dev .
build:
docker buildx build --target production -t gnome_nepal:latest .
freeze:
rm requirements.txt && pip freeze > requirements.txt
dev:
python manage.py migrate --noinput
make create_admin
python manage.py runserver 0.0.0.0:8000
cleanup:
## make a cleanup code
prod:
python manage.py migrate --noinput
python manage.py collectstatic --no-input
make create_admin
python -m gunicorn core.wsgi:application \
--bind 0.0.0.0:8000 -w 2 --log-level info \
--access-logfile ./logs/gunicorn.access.log \
--error-logfile ./logs/gunicorn.error.log
sops_encrypt:
sops --encrypt ./.openshift/secrets.yaml > ./.openshift/secrets.enc.yaml
sops_decrypt:
sops --decrypt ./.openshift/secrets.enc.yaml > ./.openshift/secrets.yaml
apply_infra:
oc apply -f ./.openshift/secrets.yaml -f ./.openshift/server.yaml -f ./.openshift/database.yaml