-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (39 loc) · 1.43 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
# This makefile provides some shortcuts to help manage a local instance of the platform
# brought up with the provided docker compose setup
# Create a sample admin account with superuser privileges with the credentials
# admin:admin
admin:
docker exec -e DJANGO_SUPERUSER_PASSWORD=admin oais_django python3 manage.py createsuperuser --noinput --username admin --email [email protected]
# Reset the database, restarting all the containers and bringing the instance back up
reset-db:
docker compose stop
docker compose down
docker volume rm oais-platform_postgres -f
docker compose up
# Show (and follow) logs of the Celery container
logs-celery:
docker logs oais_celery -f
# Show (and follow) logs of the Django container
logs-django:
docker logs oais_django -f
# Attach to a shell inside the Django container
shell:
docker exec -it oais_django sh
# Spawn a django interactive shell and attach to it
django-shell:
docker exec -it oais_django python manage.py shell
# Prepare migrations and apply them
migrations:
docker exec oais_django python manage.py makemigrations
docker exec oais_django python manage.py migrate
# Cleans up logs and local data (e.g. SIPs)
# should be run with a "reset-db"
clean:
rm -rf oais-data/*
rm *.tmp
# Run tests according to the compose test setup
test:
docker compose -f test-compose.yml up --exit-code-from django
# Create API token
add-token:
docker exec oais_django python manage.py drf_create_token $(foo)