Compare commits
10 commits
850ebff7c0
...
d83adf0473
Author | SHA1 | Date | |
---|---|---|---|
Simon Vieille | d83adf0473 | ||
b9f5785fa6 | |||
0d1f1e29b5 | |||
28f8e5c583 | |||
1f9161feef | |||
7800a01499 | |||
bbb1804f31 | |||
a273a9aac1 | |||
6e005690da | |||
b324bfcd97 |
|
@ -1,7 +1,7 @@
|
||||||
variables:
|
variables:
|
||||||
- &volumes
|
- &volumes
|
||||||
- node16_cache:/root/.npm
|
- node16_cache:/root/.npm
|
||||||
- /data/deblan/deblan.io-murph:/data/deblan/deblan.io-murph
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event: [push, pull_request, tag, manual]
|
event: [push, pull_request, tag, manual]
|
||||||
|
@ -67,11 +67,10 @@ steps:
|
||||||
failure: ignore
|
failure: ignore
|
||||||
|
|
||||||
cache-build:
|
cache-build:
|
||||||
image: deblan/php:8.1
|
image: deblan/mage
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
commands:
|
commands:
|
||||||
- apt-get update && apt-get -y install rsync
|
- cd /builds
|
||||||
- cd /data/deblan/deblan.io-murph/
|
|
||||||
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
variables:
|
variables:
|
||||||
- &volumes
|
- &volumes
|
||||||
- /data/deblan/deblan.io-murph:/data/deblan/deblan.io-murph
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event: [deployment]
|
event: [deployment]
|
||||||
|
|
||||||
|
skip_clone: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
app-deploy:
|
app-deploy:
|
||||||
image: deblan/php:8.1
|
image: deblan/mage
|
||||||
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
|
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
|
||||||
volumes: *volumes
|
volumes: *volumes
|
||||||
commands:
|
commands:
|
||||||
- apt-get update && apt-get -y install rsync openssh-client
|
- cd "/builds/$CI_COMMIT_SHA"
|
||||||
- cd "/data/deblan/deblan.io-murph/$CI_COMMIT_SHA"
|
|
||||||
- mkdir "$HOME/.ssh"
|
- mkdir "$HOME/.ssh"
|
||||||
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
||||||
- chmod 700 "$HOME/.ssh"
|
- chmod 700 "$HOME/.ssh"
|
||||||
- chmod 600 "$HOME/.ssh/id_ed25519"
|
- chmod 600 "$HOME/.ssh/id_ed25519"
|
||||||
- composer global require andres-montanez/magallanes
|
|
||||||
- cp .mage.yml.dist .mage.yml
|
- cp .mage.yml.dist .mage.yml
|
||||||
- sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
- sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
||||||
- sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
- sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
||||||
- sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
- sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
||||||
- /root/.config/composer/vendor/bin/mage deploy "$CI_BUILD_DEPLOY_TARGET"
|
- mage deploy "$CI_PIPELINE_DEPLOY_TARGET"
|
||||||
|
|
|
@ -22,7 +22,7 @@ help() {
|
||||||
-l debug|info|notice|warning|error
|
-l debug|info|notice|warning|error
|
||||||
Debug level
|
Debug level
|
||||||
|
|
||||||
-a start|stop|restart
|
-a start|stop|restart|status
|
||||||
EOH
|
EOH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,52 +34,23 @@ on_interrupt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start_messenger() {
|
start_messenger() {
|
||||||
started=0
|
nohup php8.1 bin/console messenger:consume 2>/dev/null >/dev/null &
|
||||||
pid=
|
log -t -l notice "Started"
|
||||||
|
|
||||||
if [ -f "$pid_file" ]; then
|
|
||||||
pid="$(cat "$pid_file")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
if [ -d "/proc/$pid" ]; then
|
|
||||||
log -t -l warning "Already running"
|
|
||||||
started=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$started" -eq 0 ]; then
|
|
||||||
nohup php8.1 bin/console messenger:consume 2>/dev/null >/dev/null &
|
|
||||||
echo -n $! > "$pid_file"
|
|
||||||
log -t -l notice "Started"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_messenger() {
|
stop_messenger() {
|
||||||
pid=
|
php8.1 bin/console messenger:stop-workers 2>/dev/null >/dev/null
|
||||||
|
log -t -l notice "Stopped"
|
||||||
|
}
|
||||||
|
|
||||||
if [ -f "$pid_file" ]; then
|
get_pid() {
|
||||||
pid="$(cat "$pid_file")"
|
pgrep -f messenger:consume
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
if [ ! -d "/proc/$pid" ]; then
|
|
||||||
log -t -l warning "Not started"
|
|
||||||
else
|
|
||||||
kill -9 "$pid"
|
|
||||||
log -t -l notice "Stopped"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm "$pid_file"
|
|
||||||
else
|
|
||||||
log -t -l warning "Not started"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$(dirname "0")"
|
cd "$(dirname "0")"
|
||||||
|
|
||||||
pid_file=var/messenger.pid
|
ACTION=
|
||||||
|
|
||||||
while getopts "l:ha:" option; do
|
while getopts "l:ha:" option; do
|
||||||
case "${option}" in
|
case "${option}" in
|
||||||
|
@ -97,10 +68,12 @@ main() {
|
||||||
elif [ "$ACTION" = "restart" ]; then
|
elif [ "$ACTION" = "restart" ]; then
|
||||||
stop_messenger
|
stop_messenger
|
||||||
start_messenger
|
start_messenger
|
||||||
|
elif [ "$ACTION" = "status" ]; then
|
||||||
|
get_pid
|
||||||
|
else
|
||||||
|
log -l error "Action is required."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# log [-t] [-l debug|info|notice|warning|error] message
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,29 +13,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-flow-row-dens grid-cols-12 md:p-8 gap-5">
|
<div class="grid grid-flow-row-dens grid-cols-12 md:p-8 gap-5">
|
||||||
{% for project in projects %}
|
{% for project in projects %}
|
||||||
<div class="card shadow-md col-span-12 md:col-span-6 lg:col-span-4 m-3 bg-box">
|
<div class="card shadow-md col-span-12 md:col-span-6 lg:col-span-4 m-3 bg-box">
|
||||||
<div class="card">
|
{% if project.image %}
|
||||||
{% if project.image %}
|
<figure>
|
||||||
<figure>
|
<img src="{{ asset(project.image)|imagine_filter('project_preview_filter') }}" alt="{{ project.label }}">
|
||||||
<img src="{{ asset(project.image)|imagine_filter('project_preview_filter') }}" alt="{{ project.label }}">
|
</figure>
|
||||||
</figure>
|
{% endif %}
|
||||||
{% endif %}
|
<div class="card-body">
|
||||||
<div class="card-body">
|
<h2 class="card-title">{{ project.label }}</h2>
|
||||||
<h2 class="card-title">{{ project.label }}</h2>
|
|
||||||
|
|
||||||
{{- project.description|murph_url|markdown('post') -}}
|
{{- project.description|murph_url|markdown('post') -}}
|
||||||
|
|
||||||
<div class="card-actions mt-5">
|
<div class="card-actions mt-5">
|
||||||
{% for link in project.links %}
|
{% for link in project.links %}
|
||||||
<a class="btn btn-xs" href="{{ link.url|murph_url }}" target="_blank">
|
<a class="btn btn-xs" href="{{ link.url|murph_url }}" target="_blank">
|
||||||
{{- link.label -}}
|
{{- link.label -}}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue