This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
255 lines (185 loc) · 5.7 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#install-client:
# docker-compose -f docker-compose.builder.yml run --rm install
#build-client:
# docker-compose -f docker-compose.builder.yml run --rm build
#dev:
# docker-compose -f docker-compose.dev.yml up -d
#prod:
# docker-compose -f docker-compose.prod.yml up -d
#down-dev:
# docker-compose -f docker-compose.dev.yml down
#down-prod:
# docker-compose -f docker-compose.prod.yml down
#sh-backend-dev:
# docker-compose -f docker-compose.dev.yml exec php-fpm sh
#-----------------------------------------------------------
# Docker
#-----------------------------------------------------------
# Wake up docker containers
up:
docker-compose up -d
up-dev:
docker-compose -f docker-compose.dev.yml up -d
# Shut down docker containers
down:
docker-compose down
# Show a status of each container
status:
docker-compose ps
# Status alias
s: status
# Show logs of each container
logs:
docker-compose logs
# Restart all containers
restart: down up
# Restart the client container
restart-client:
docker-compose restart node
# Restart the client container alias
rc: restart-client
# Show the client logs
logs-client:
docker-compose logs node
# Show the client logs alias
lc: logs-client
# Build and up docker containers
build:
docker-compose up -d --build
# Build containers with no cache option
build-no-cache:
docker-compose build --no-cache
# Build and up docker containers
rebuild: down build
# Run terminal of the php container
php:
docker-compose exec php-fpm sh
# Run terminal of the client container
client:
docker-compose exec node sh
# Install client npm packages
install-client:
docker-compose -f docker-compose.builder.yml run --rm install
# Build client application
build-client:
docker-compose -f docker-compose.builder.yml run --rm build
#-----------------------------------------------------------
# Logs
#-----------------------------------------------------------
# Clear file-based logs
logs-clear:
sudo rm docker/logs/nginx/*.log
#-----------------------------------------------------------
# Database
#-----------------------------------------------------------
# Run database migrations
db-migrate:
docker-compose exec php-fpm php artisan migrate
# Migrate alias
migrate: db-migrate
# Run migrations rollback
db-rollback:
docker-compose exec php-fpm php artisan migrate:rollback
# Rollback alias
rollback: db-rollback
# Run seeders
db-seed:
docker-compose exec php-fpm php artisan db:seed
# Fresh all migrations
db-fresh:
docker-compose exec php-fpm php artisan migrate:fresh
#-----------------------------------------------------------
# Redis
#-----------------------------------------------------------
redis:
docker-compose exec redis redis-cli
redis-flush:
docker-compose exec redis redis-cli FLUSHALL
redis-install:
docker-compose exec php-fpm composer require predis/predis
#-----------------------------------------------------------
# Queue
#-----------------------------------------------------------
# Restart queue process
queue-restart:
docker-compose exec php-fpm php artisan queue:restart
#-----------------------------------------------------------
# Testing
#-----------------------------------------------------------
# Run phpunit tests
test:
docker-compose exec php-fpm vendor/bin/phpunit --order-by=defects --stop-on-defect
# Run all tests ignoring failures.
test-all:
docker-compose exec php-fpm vendor/bin/phpunit --order-by=defects
# Run phpunit tests with coverage
coverage:
docker-compose exec php-fpm vendor/bin/phpunit --coverage-html tests/report
#-----------------------------------------------------------
# Dependencies
#-----------------------------------------------------------
# Install composer dependencies
composer-install:
docker-compose exec php-fpm composer install
# Update composer dependencies
composer-update:
docker-compose exec php-fpm composer update
# Update npm dependencies
npm-update:
docker-compose exec node npm install
# Update all dependencies
dependencies-update: composer-update npm-update
#-----------------------------------------------------------
# Tinker
#-----------------------------------------------------------
# Run tinker
tinker:
docker-compose exec php-fpm php artisan tinker
#-----------------------------------------------------------
# Installation
#-----------------------------------------------------------
# Copy the Laravel API environment file
env-api:
cp .env.api api/.env
# Copy the NuxtJS environment file
env-client:
cp .env.client client/.env
# Add permissions for Laravel cache and storage folders
permissions:
sudo chmod -R 777 api/bootstrap/cache
sudo chmod -R 777 api/storage
# Permissions alias
perm: permissions
# Generate a Laravel app key
key:
docker-compose exec php-fpm php artisan key:generate --ansi
# Generate a Laravel storage symlink
storage:
docker-compose exec php-fpm php artisan storage:link
# PHP composer autoload command
autoload:
docker-compose exec php-fpm composer dump-autoload
# Install the environment
install: build env-api env-client composer-install key storage permissions migrate rc
#-----------------------------------------------------------
# Git commands
#-----------------------------------------------------------
# Undo the last commit
git-undo:
git reset --soft HEAD~1
# Make a Work In Progress commit
git-wip:
git add .
git commit -m "WIP"
# Export the codebase as app.zip archive
git-export:
git archive --format zip --output app.zip master
#-----------------------------------------------------------
# Clearing
#-----------------------------------------------------------
# Shut down and remove all volumes
remove-volumes:
docker-compose down --volumes
# Remove all existing networks (useful if network already exists with the same attributes)
prune-networks:
docker network prune