2023-03-20 11:05:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Inspired on https://github.com/adriancooney/Taskfile
|
2023-04-04 13:30:45 +00:00
|
|
|
#
|
|
|
|
# Install an alias, to be able to simply execute `run`
|
2023-04-24 11:25:02 +00:00
|
|
|
# echo 'alias run=./scripts/run' >> ~/.aliases
|
2023-03-20 11:05:08 +00:00
|
|
|
#
|
2023-04-04 13:30:45 +00:00
|
|
|
# Define Docker Compose command prefix...
|
2023-03-20 11:05:08 +00:00
|
|
|
set -e
|
|
|
|
|
2023-04-04 13:30:45 +00:00
|
|
|
if [ $? == 0 ]; then
|
|
|
|
DOCKER_COMPOSE="docker compose"
|
|
|
|
else
|
|
|
|
DOCKER_COMPOSE="docker-compose"
|
|
|
|
fi
|
|
|
|
|
2023-03-20 11:05:08 +00:00
|
|
|
function help {
|
|
|
|
echo "$0 <task> <args>"
|
|
|
|
echo "Tasks:"
|
|
|
|
compgen -A function | cat -n
|
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-10-02 12:58:29 +00:00
|
|
|
function setup:dev {
|
2023-10-05 06:54:03 +00:00
|
|
|
docker exec coolify bash -c "composer install"
|
2023-10-17 18:54:26 +00:00
|
|
|
docker exec coolify bash -c "php artisan key:generate"
|
2023-10-02 12:58:29 +00:00
|
|
|
docker exec coolify bash -c "php artisan migrate:fresh --seed"
|
2023-10-17 18:54:26 +00:00
|
|
|
sudo chmod -R o+rwx .
|
2023-10-02 12:58:29 +00:00
|
|
|
}
|
2023-07-04 11:40:37 +00:00
|
|
|
function sync:v3 {
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
skopeo copy --all docker://ghcr.io/coollabsio/coolify:$1 docker://coollabsio/coolify:$1
|
|
|
|
}
|
2023-05-24 12:56:41 +00:00
|
|
|
function sync:bunny {
|
2023-05-03 07:57:06 +00:00
|
|
|
php artisan sync:bunny --env=secrets
|
2023-04-28 13:22:36 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-04-24 11:25:02 +00:00
|
|
|
function queue {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan queue:listen
|
2023-04-24 11:25:02 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-05-23 13:48:05 +00:00
|
|
|
function horizon {
|
2023-08-11 14:13:53 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan horizon -vvv
|
2023-05-23 13:48:05 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-04-28 07:00:47 +00:00
|
|
|
function schedule {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan schedule:work
|
2023-04-28 07:00:47 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-05-24 12:56:41 +00:00
|
|
|
function schedule:run {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan schedule:run
|
2023-04-28 07:00:47 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
|
|
|
|
2023-06-19 08:58:00 +00:00
|
|
|
function db {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan db
|
2023-06-19 08:58:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function db:migrate {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan migrate
|
2023-05-12 18:15:36 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-08-24 14:14:09 +00:00
|
|
|
function db:reset {
|
|
|
|
bash spin exec -u webuser coolify php artisan migrate:fresh --seed
|
|
|
|
}
|
2023-05-24 12:56:41 +00:00
|
|
|
function db:reset-prod {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan migrate:fresh --force --seed --seeder=ProductionSeeder ||
|
2023-05-16 13:10:29 +00:00
|
|
|
php artisan migrate:fresh --force --seed --seeder=ProductionSeeder
|
2023-05-09 12:45:47 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-06-19 08:58:00 +00:00
|
|
|
function mfs {
|
|
|
|
db:reset
|
|
|
|
}
|
|
|
|
|
2023-04-24 11:49:29 +00:00
|
|
|
function coolify {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify bash
|
2023-04-24 11:25:02 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-05-24 12:56:41 +00:00
|
|
|
function coolify:root {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec coolify bash
|
2023-04-24 11:25:02 +00:00
|
|
|
}
|
2023-05-25 10:00:09 +00:00
|
|
|
function coolify:proxy {
|
|
|
|
docker exec -ti coolify-proxy sh
|
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-05-24 12:26:50 +00:00
|
|
|
function redis {
|
|
|
|
docker exec -ti coolify-redis redis-cli
|
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-04-24 11:25:02 +00:00
|
|
|
function vite {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec vite bash
|
2023-04-24 11:25:02 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
2023-05-03 06:51:11 +00:00
|
|
|
function tinker {
|
2023-07-04 11:40:37 +00:00
|
|
|
bash spin exec -u webuser coolify php artisan tinker
|
2023-05-03 06:51:11 +00:00
|
|
|
}
|
2023-05-24 12:27:59 +00:00
|
|
|
|
|
|
|
|
2023-08-11 14:13:53 +00:00
|
|
|
function build:helper {
|
|
|
|
act -W .github/workflows/coolify-helper.yml --secret-file .env.secrets
|
2023-05-24 12:27:59 +00:00
|
|
|
}
|
2023-03-20 11:05:08 +00:00
|
|
|
function default {
|
|
|
|
help
|
|
|
|
}
|
|
|
|
|
|
|
|
TIMEFORMAT="Task completed in %3lR"
|
|
|
|
time "${@:-default}"
|