-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile.deploy
64 lines (37 loc) · 2.01 KB
/
Makefile.deploy
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
.PHONY: help
include Makefile.param.prod
all: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
remotedu: ## Execute DU command in htdocs dir, just for diagnostic purpose
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; du -h"
rsynca: ## execute Rsync from current dir and remote htdocs ${WEB_DIR}
rsync ${DRY_RUN} -rlcgoDvzi -e "ssh" --delete . ${SSH_ALIAS}:${WEB_DIR} --exclude-from 'exclude-list.txt'
copyenvprod:
scp .env.prod ${SSH_ALIAS}:${WEB_DIR}/.env
fixgroupuser: ## Add the right group(www) to the deploy user (ssh user)
ssh -t ${SSH_ALIAS} "sudo usermod -a -G ${WEB_GROUP} ${SSH_USER}"
fixownership: ## fix the ownership for user ${WEB_USER} into ${WEB_DIR}/storage
ssh -t ${SSH_ALIAS} "sudo chown -R ${WEB_USER}:${WEB_GROUP} ${WEB_DIR}/storage; ls -lao ${WEB_DIR}/storage"
newdeploy: buildfrontend rsynca copyenvprod fixgroupuser fixownership migrate ##first deploy
migratestatus: ## list the migration status
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan migrate:status --env=prod"
migrate: ## Execute migrate command for DB schema
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan migrate --env=prod"
migrateseed: ## Execute migrate command for DB schema
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan migrate:refresh --seed --env=prod"
migraterefresh: ## Execute migrate command for DB schema
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan migrate:refresh"
buildfrontend: ## execute npm task to compile frontend assets (js and css...)
npm run build
optimize: ## Optimize application in production
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan config:cache; php artisan route:cache; php artisan view:cache"
laralens: ## Execute Diagnostic on the server
ssh ${SSH_ALIAS} "cd ${WEB_DIR}; php artisan laralens:diagnostic"
composerinstallnodev:
composer install --no-dev
installdevdeps:
composer install
npm run dev
php artisan config:clear
deploy: buildfrontend composerinstallnodev rsynca copyenvprod migrate installdevdeps