-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
69 lines (51 loc) · 2.47 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
COMPOSE_FILE=./develop/docker-compose.yml
BUILD_NAME=netbox-cmdb
PLUGINS_LIST=netbox_cmdb
cbuild:
docker compose -f ${COMPOSE_FILE} \
-p ${BUILD_NAME} build
debug:
@echo "Starting Netbox .. "
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up
start:
@echo "Starting Netbox in detached mode.. "
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d
stop:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
status:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} ps
logs:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} logs
logs-follow:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} logs -f
destroy:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
docker volume rm -f ${BUILD_NAME}_pgdata_netbox_plugins
nbshell:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py nbshell
shell:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py shell
adduser:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py createsuperuser
collectstatic:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py collectstatic
migrations:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d postgres
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} \
run netbox python manage.py makemigrations --no-header
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
test:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py test ${PLUGINS_LIST}
backupdb:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d postgres
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} exec postgres pg_dump --username netbox --host localhost netbox --file /tmp/backup.sql
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} cp postgres:/tmp/backup.sql ./db_backup.sql
restoredb: cleandb
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} cp ./db_backup.sql postgres:/tmp/backup.sql
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} exec postgres sh -c "psql --username netbox --host localhost netbox < /tmp/backup.sql >/dev/null"
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d
cleandb:
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} down
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} up -d postgres
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} exec postgres dropdb --username netbox --host localhost netbox --if-exists
docker compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} exec postgres createdb --username netbox --host localhost netbox