-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
92 lines (66 loc) · 3.4 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
include .env
#export $(shell sed 's/=.*//' envfile)
export POSTGRES_DB=postgresql://$(DB_USERNAME):$(DB_PASSWORD)@127.0.0.1:$(DB_PORT)/$(DB_DATABASE)
export NOW_DB_PREFIX=$(date +\%Y-\%m-\%d-\%H:\%M:\%S)
test-phpunit:
- docker compose exec --user=1000 api bash -c "./vendor/bin/phpunit"
bash:
- docker compose exec --user=1000 api bash
bash-sudo:
- docker compose exec api bash
migrate-fresh-quick:
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan migrate:fresh --seed"
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan passport:keys --force"
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan passport:client --personal --no-interaction"
- docker compose exec --user=1000 api bash -c "cp storage/oauth-private.key vendor/orchestra/testbench-core/laravel/storage/oauth-private.key"
composer-update:
- docker compose exec api bash -c "XDEBUG_MODE=off composer self-update"
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off composer update"
## supervisd must be restarted, horizon & scheduler must fetch new code
- docker compose restart escola_lms_queue_cron
restart_queue_cron:
- docker compose restart escola_lms_queue_cron
update-composer-to-git:
- git checkout develop
- git pull
- docker compose up -d api
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off composer update --no-scripts"
- git add composer.lock
- git commit -m "updating dependecies"
- git push origin develop
swagger-generate:
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan l5-swagger:generate"
h5p-seed:
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan db:seed --class=H5PLibrarySeeder"
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan db:seed --class=H5PContentSeeder"
- docker compose exec --user=1000 api bash -c "XDEBUG_MODE=off php artisan db:seed --class=H5PContentCoursesSeeder"
node-packages:
# install globally at /usr/bin/mjml
- docker compose exec --user=1000 api bash -c "npm install -g mjml"
tinker:
# use CTRL+C to quit and CTRL+D to refresh tinker
- docker compose exec --user=1000 api bash -c "while true; do php artisan tinker; done"
migrate-fresh: migrate-fresh-quick h5p-seed
refresh: composer-update migrate-fresh h5p-seed
docker-up:
- docker compose up -d
switch-to-postgres:
- cp docker/envs/.env.postgres.example .env
- docker compose exec --user=1000 api bash -c "php artisan config:cache"
migrate-postgres: switch-to-postgres migrate-fresh-quick
test-phpunit-postgres: switch-to-postgres test-phpunit
test-fresh: migrate-fresh-quick test-phpunit
# creates a backup file into `data` folder
backup-postgres:
- docker compose exec postgres bash -c "pg_dump --clean --dbname=$(POSTGRES_DB) -f /var/lib/postgresql/backups/backup-$(NOW_DB_PREFIX).sql"
- docker compose exec postgres bash -c "cp /var/lib/postgresql/backups/backup-$(NOW_DB_PREFIX).sql /var/lib/postgresql/backups/backup-latest.sql"
# imports database backup from data folder
# make import BACKUP_FILE=backup-2020-09-15-14:49:22.sql
# or
# make import BACKUP_FILE=backup-latest.sql
#import-postgres: backup-postgres
import-postgres:
- docker compose exec postgres bash -c "psql --dbname=$(POSTGRES_DB) < /var/lib/postgresql/backups/$(BACKUP_FILE)"
init: docker-up switch-to-postgres composer-update migrate-fresh-quick
wait:
- docker compose exec --user=1000 api bash -c "./wait.sh"