-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.old
executable file
·183 lines (150 loc) · 5.79 KB
/
Makefile.old
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
dev:
docker compose -f docker-compose.yml up -d --build
# Debug
interactive:
docker compose -f docker-compose.yml up --build
# Stop all Containers
stop:
docker compose -f docker-compose.yml stop
# Build from clean
app-build-clean: folder-structure layout-images dev app-build-dep wait database-migrate database-seed generate-key stop ssh-keygen
# Build Dependencies
app-build-dep: composer-install npm-install
# Build Dev App & Dependencies
app-build-dep-dev: composer-install-dev npm-install-dev
###########
# HELPERS #
###########
# Make .env
env-file:
cp .env.example src/.env
# Make blank .env
env-file-blank:
touch src/.env
# echo "APP_KEY=" >> src/.env
# Move default images to Storage
layout-images:
cp -r src/resources/assets/images/* src/storage/app/public/images/main/
mv src/storage/app/public/images/main/shop/* src/storage/app/public/images/shop/
# Create Symlink for Storage
symlink:
docker exec eventula_manager_app php artisan storage:link
# Create & Update the Database
database-migrate:
docker exec eventula_manager_app php artisan migrate
# Seed the Database
database-seed:
docker exec eventula_manager_app php artisan db:seed
# Rollback last Database Migration
database-rollback:
docker exec eventula_manager_app php artisan db:rollback
# Generate Application key
generate-key:
docker exec eventula_manager_app php artisan key:generate
# Generate Settings - This will erase your current settings!
generate-settings:
docker exec eventula_manager_app php artisan db:seed --class=SettingsTableSeeder
# Generate Appearance - This will erase your current settings!
generate-appearance:
docker exec eventula_manager_app php artisan db:seed --class=AppearanceTableSeeder
# Create Default Folder structure
folder-structure:
mkdir -p src/storage/app/public/images/gallery/
mkdir -p src/storage/app/public/images/events/
mkdir -p src/storage/app/public/images/venues/
mkdir -p src/storage/app/public/images/main/
mkdir -p src/storage/app/public/images/shop/
# Permissions - Dev
permissions:
chown -R ${USER}:101 src/
find src -type f -exec chmod 664 {} \;
find src -type d -exec chmod 775 {} \;
chgrp -R 101 src/storage src/bootstrap/cache
chmod -R ug+rwx src/storage src/bootstrap/cache
# Permissions - Docker
permissions-docker:
chown -R 100:101 src/
find src -type f -exec chmod 664 {} \;
find src -type d -exec chmod 775 {} \;
chgrp -R 101 src/storage src/bootstrap/cache
chmod -R ug+rwx src/storage src/bootstrap/cache
# Create SSL Keypair for Development
ssh-keygen:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout resources/certs/eventula_manager.key -out resources/certs/eventula_manager.crt
# Install PHP Dependencies via Composer
composer-install:
docker run --rm --name compose-maintainence --interactive \
--volume $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/app \
--user $(id -u):$(id -g) \
composer:2 install --ignore-platform-reqs --no-scripts
# Install Dev PHP Dependencies via Composer
composer-install-dev:
docker run --rm --name compose-maintainence-dev --interactive \
-v $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/app \
--user $(id -u):$(id -g) \
composer:2 install --ignore-platform-reqs --no-scripts --dev
# Update Dev PHP Dependencies via Composer
composer-update:
docker run --rm --name compose-maintainence-update --interactive \
--volume $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/app \
--user $(id -u):$(id -g) \
composer:2 update --ignore-platform-reqs --no-scripts --with-all-dependencies
# Update Dev PHP Dependencies via Composer - usage make composer-add-dep module=module/namehere
composer-add-dep:
docker run --rm --name compose-maintainence-update --interactive \
--volume $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/app \
--user $(id -u):$(id -g) \
composer:2 require $(module) --ignore-platform-reqs --no-scripts
# Install JS Dependencies via NPM
npm-install:
docker run --rm --name js-maintainence --interactive \
-v $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/usr/src/app \
-w /usr/src/app \
node:8 /bin/bash -ci "npm install && node_modules/.bin/gulp --production"
# Install Dev JS Dependencies via NPM
npm-install-dev:
docker run --rm --name js-maintainence-dev --interactive \
-v $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/usr/src/app \
-w /usr/src/app \
node:8 /bin/bash -ci "npm install && node_modules/.bin/gulp"
# Gulp Runner
gulp:
docker run --rm --name js-maintainence-dev --interactive \
-v $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/src:/usr/src/app \
-w /usr/src/app \
node:8 /bin/bash -ci "node_modules/.bin/gulp"
# Purge Containers
purge-containers:
docker compose -f docker-compose.yml -p eventula_manager stop
docker compose -f docker-compose.yml -p eventula_manager rm -vf
docker rm eventula_manager_app
docker rm eventula_manager_database
docker volume rm eventula_manager_db
# Purge Caches
purge-cache:
sudo rm -rf src/storage/framework/cache/*
sudo rm -rf src/storage/framework/views/*
sudo rm -rf src/storage/framework/sessions/*
sudo rm -rf src/bootstrap/cache/*
sudo rm -rf src/storage/debugbar/*
# Wait for containers to initialize
wait:
sleep 30
###############
# DANGER ZONE #
###############
# Clean ALL! DANGEROUS!
purge-all: stop purge-containers purge-cache
echo 'This is dangerous!'
echo 'This will totally remove all data and information stored in your app!'
echo 'do you want to continue? (Y/N)'
sudo rm -rf src/vendor/
sudo rm -rf src/node_modules/
sudo rm -rf src/public/css/*
sudo rm -rf src/storage/app/public/images/gallery
sudo rm -rf src/storage/app/public/images/events
sudo rm -rf src/storage/app/public/images/venues
sudo rm -rf src/storage/app/public/images/main
sudo rm -rf src/storage/logs/*
sudo rm src/public/storage
.ONESHELL: