Skip to content

Commit ba3481c

Browse files
authored
Update Gitpod automation for services and commands
Refactor Gitpod automation configuration to include services for MySQL, Redis, PHP server, and Laravel queue worker with appropriate commands and dependencies.
1 parent 79fa920 commit ba3481c

File tree

1 file changed

+113
-30
lines changed

1 file changed

+113
-30
lines changed

.gitpod/automations.yaml

Lines changed: 113 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,121 @@
4747
# echo "Testing: https://localhost:3000"
4848

4949

50-
tasks:
51-
cloneInit:
52-
command: |
53-
git clone https://github.com/allforks/automations_bug /workspaces/init || true
54-
description: Clone init repository
55-
name: "Clone init repository"
50+
51+
services:
52+
mysql:
53+
name: MySQL Service
54+
description: Runs MySQL server manually and keeps it alive while port 3306 is open
5655
triggeredBy:
57-
- manual
58-
59-
gitHooks:
60-
command: /workspaces/init/git/setup.sh
61-
description: Configure git hooks
62-
name: "Configure git"
63-
dependsOn:
64-
- cloneInit
56+
- postDevcontainerStart
57+
# - postEnvironmentStart
58+
commands:
59+
start: |
60+
# Start mysql server in safe mode
61+
mysqld_safe --datadir=/var/lib/mysql \
62+
--socket=/var/run/mysqld/mysqld.sock \
63+
--pid-file=/var/run/mysqld/mysqld.pid \
64+
--user=mysql &
65+
66+
# Wait before running setup
67+
sleep 10
68+
69+
# Run mysql setup script
70+
chmod +x .gitpod/setup/setup_mysql.sh && .gitpod/setup/setup_mysql.sh
71+
72+
# Keep service alive while port 3306 is open
73+
chmod +x .gitpod/helpers/keep-alive-until-port-closed.sh
74+
.gitpod/helpers/keep-alive-until-port-closed.sh localhost 3306 5 3
75+
stop: mysqladmin -u root -proot shutdown || true
76+
77+
redis:
78+
name: Redis Service
79+
description: Runs Redis server in background and keeps it alive while port 6379 is open
6580
triggeredBy:
66-
- manual
67-
68-
setupRust:
69-
command: /workspaces/init/rust/setup.sh ${GITPOD_GIT_USER_EMAIL} ${ARTIFACTORY_TOKEN}
70-
description: Configure rust environment
71-
name: "Configure rust"
81+
- postDevcontainerStart
82+
# - postEnvironmentStart
83+
commands:
84+
start: |
85+
# Start redis in background
86+
redis-server --daemonize yes
87+
88+
# Keep service alive while port 6379 is open
89+
chmod +x .gitpod/helpers/keep-alive-until-port-closed.sh
90+
.gitpod/helpers/keep-alive-until-port-closed.sh localhost 6379 5 3
91+
stop: redis-cli shutdown
92+
93+
php-server:
94+
name: PHP Development Server
95+
description: Runs Laravel setup and starts PHP built-in server
7296
triggeredBy:
7397
- postDevcontainerStart
74-
dependsOn:
75-
- cloneInit
76-
- gitHooks
77-
78-
testVar:
79-
name: Test project variable
80-
command: |
81-
echo ${FOO:-'not set :('}
82-
echo "$FOO" > $HOME/foo
98+
# - postEnvironmentStart
99+
commands:
100+
start: |
101+
# Run base environment setup
102+
chmod +x .gitpod/setup/setup_environment.sh && .gitpod/setup/setup_environment.sh
103+
104+
# Run laravel setup (composer + artisan)
105+
chmod +x .gitpod/setup/setup_laravel.sh && .gitpod/setup/setup_laravel.sh
106+
107+
# Restart tail process for logs
108+
killall -q tail || true
109+
touch storage/logs/laravel.log
110+
tail -f -n 0 storage/logs/laravel.log | egrep -v '^#' &
111+
112+
# Start php built-in server
113+
PHP_CLI_SERVER_WORKERS=10 php -S 0.0.0.0:8000 -t public .gitpod/cachingRouter.php
114+
stop: killall php || true
115+
116+
npm-hot-reload:
117+
name: NPM Hot Reload Service
118+
description: Installs dependencies and runs Laravel Mix hot reload server
83119
triggeredBy:
84-
- postDevcontainerStart
120+
- postDevcontainerStart
121+
# - postEnvironmentStart
122+
commands:
123+
start: |
124+
# Install NPM dependencies & run hot reload server
125+
npm install
126+
npm run hot-gitpod
127+
stop: killall node || true
128+
129+
expose-tunnel:
130+
name: Expose.dev Tunnel Server
131+
description: Creates public tunnel for Laravel dev server via Expose.dev
132+
triggeredBy:
133+
- postDevcontainerStart
134+
# - postEnvironmentStart
135+
commands:
136+
start: |
137+
# Run custom port setup
138+
chmod +x .gitpod/setup/setup_ports.sh && .gitpod/setup/setup_ports.sh
139+
140+
# Authenticate expose client
141+
.gitpod/expose token ${EXPOSE_DEV_TOKEN}
142+
143+
# Keep sharing tunnel to expose.dev
144+
while true; do
145+
.gitpod/expose share http://0.0.0.0:8000 \
146+
--domain=dev.ideasoverflow.nl \
147+
--server=eu-1 \
148+
--subdomain=${EXPOSE_SUBDOMAIN_HANSON}
149+
sleep 5
150+
done
151+
stop: killall expose || true
152+
153+
queue-worker:
154+
name: Laravel Queue Worker
155+
description: Waits for port 8000 and starts a Laravel queue worker
156+
triggeredBy:
157+
- postDevcontainerStart
158+
# - postEnvironmentStart
159+
commands:
160+
start: |
161+
# Wait for port 8000 using helper
162+
chmod +x .gitpod/helpers/wait-for-port.sh
163+
.gitpod/helpers/wait-for-port.sh localhost 8000
164+
165+
# Run worker for specified queue (default if not provided)
166+
php artisan queue:work --queue=default,website-requests,offer-maintenances,analytics,mailchimp,user-emails,offers-export
167+
stop: killall php || true

0 commit comments

Comments
 (0)