forked from ruby-china/homeland-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (55 loc) · 1.88 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
RAKE = docker-compose run app bundle exec rake
RUN = docker-compose run app
RUN_DB = docker-compose run postgresql
RUN_WEB = docker-compose run web
ACME = /root/.acme.sh/acme.sh
ACME_HOME = --home /home/app/ssl
install:
@make secret
@touch app.local.env
@$(RUN) bundle exec rails db:create
@$(RUN) bundle exec rails db:migrate
@$(RUN) bundle exec rails db:seed
install_ssl:
docker-compose start web
$(RUN_WEB) bash -c 'echo $$cert_domain'
$(RUN_WEB) bash -c '$(ACME) --issue -d $$cert_domain -w /home/app/homeland/public $(ACME_HOME) --debug'
openssl dhparam -out shared/ssl/dhparam.pem 2048
$(RUN_WEB) bash -c '$(ACME) --installcert $(ACME_HOME) -d $$cert_domain --keypath /home/app/ssl/homeland.key --fullchainpath /home/app/ssl/homeland.crt --reloadcmd "nginx -s reload"'
@echo "---------------------------------------------\n\nSSL install successed.\n\nNow you need enable https=true by update app.local.env.\nAnd then run: make restart\n\n"
update:
@sh ./scripts/create-version
@docker-compose pull
@make secret
@touch app.local.env
@make restart
@docker tag homeland/homeland:latest homeland/homeland:$$(date "+%Y%m%d%H%M%S")
restart:
@sh ./scripts/restart-app
@docker-compose stop web
@docker-compose up -d web
@docker-compose stop app_backup
start:
@docker-compose up -d
status:
@docker-compose ps
stop:
@docker-compose stop web app app_backup worker
stop-all:
@docker-compose down
rollback:
@sh ./scripts/rollback-app
console:
@$(RUN) bundle exec rails console
reindex:
@echo "Reindex Search..."
@$(RAKE) reindex
secret:
@test -f app.secret.env || echo "SECRET_KEY_BASE=`openssl rand -hex 32`" > app.secret.env
@cat app.secret.env
clean:
@echo "Clean Docker images..."
@docker ps -aqf status=exited | xargs docker rm && docker images -qf dangling=true | xargs docker rmi
backup:
@echo "Backing up database..."
@$(RUN_DB) pg_dump -d homeland -h postgresql -U postgres > postgres.sql