Changeset View
Changeset View
Standalone View
Standalone View
bin/quickstart.sh
#!/bin/bash | #!/bin/bash | ||||
set -e | set -e | ||||
function die() { | function die() { | ||||
echo "$1" | echo "$1" | ||||
exit 1 | exit 1 | ||||
} | } | ||||
rpm -qv docker-compose >/dev/null 2>&1 || \ | |||||
test ! -z "$(which docker-compose 2>/dev/null)" || \ | |||||
die "Is docker-compose installed?" | |||||
test ! -z "$(grep 'systemd.unified_cgroup_hierarchy=0' /proc/cmdline)" || \ | test ! -z "$(grep 'systemd.unified_cgroup_hierarchy=0' /proc/cmdline)" || \ | ||||
die "systemd containers only work with cgroupv1 (use 'grubby --update-kernel=ALL --args=\"systemd.unified_cgroup_hierarchy=0\"' and a reboot to fix)" | die "systemd containers only work with cgroupv1 (use 'grubby --update-kernel=ALL --args=\"systemd.unified_cgroup_hierarchy=0\"' and a reboot to fix)" | ||||
base_dir=$(dirname $(dirname $0)) | base_dir=$(dirname $(dirname $0)) | ||||
# Always reset .env with .env.example | # Always reset .env with .env.example | ||||
cp src/.env.example src/.env | cp src/.env.example src/.env | ||||
if [ -f "src/env.local" ]; then | if [ -f "src/env.local" ]; then | ||||
# Ensure there's a line ending | # Ensure there's a line ending | ||||
echo "" >> src/.env | echo "" >> src/.env | ||||
cat src/env.local >> src/.env | cat src/env.local >> src/.env | ||||
fi | fi | ||||
export DOCKER_BUILDKIT=0 | |||||
docker pull docker.io/kolab/centos7:latest | docker pull docker.io/kolab/centos7:latest | ||||
docker-compose down --remove-orphans | docker compose down --remove-orphans | ||||
src/artisan octane:stop >/dev/null 2>&1 || : | src/artisan octane:stop >/dev/null 2>&1 || : | ||||
src/artisan horizon:terminate >/dev/null 2>&1 || : | src/artisan horizon:terminate >/dev/null 2>&1 || : | ||||
docker-compose build coturn kolab mariadb meet pdns-sql proxy redis nginx | docker compose build coturn kolab mariadb meet pdns-sql proxy redis nginx | ||||
bin/regen-certs | bin/regen-certs | ||||
docker-compose up -d coturn kolab mariadb meet pdns-sql proxy redis | docker compose up -d coturn kolab mariadb meet pdns-sql proxy redis | ||||
# Workaround until we have docker-compose --wait (https://github.com/docker/compose/pull/8777) | # Workaround until we have docker-compose --wait (https://github.com/docker/compose/pull/8777) | ||||
function wait_for_container { | function wait_for_container { | ||||
container_id="$1" | container_id="$1" | ||||
container_name="$(docker inspect "${container_id}" --format '{{ .Name }}')" | container_name="$(docker inspect "${container_id}" --format '{{ .Name }}')" | ||||
echo "Waiting for container: ${container_name} [${container_id}]" | echo "Waiting for container: ${container_name} [${container_id}]" | ||||
waiting_done="false" | waiting_done="false" | ||||
while [[ "${waiting_done}" != "true" ]]; do | while [[ "${waiting_done}" != "true" ]]; do | ||||
Show All 13 Lines | |||||
} | } | ||||
# Ensure the containers we depend on are fully started | # Ensure the containers we depend on are fully started | ||||
wait_for_container 'kolab' | wait_for_container 'kolab' | ||||
wait_for_container 'kolab-redis' | wait_for_container 'kolab-redis' | ||||
if [ "$1" == "--nodev" ]; then | if [ "$1" == "--nodev" ]; then | ||||
echo "starting everything in containers" | echo "starting everything in containers" | ||||
docker-compose build swoole webapp | docker compose build swoole | ||||
docker-compose up -d webapp nginx | docker compose build webapp | ||||
docker compose up -d webapp nginx | |||||
wait_for_container 'kolab-webapp' | wait_for_container 'kolab-webapp' | ||||
exit 0 | exit 0 | ||||
fi | fi | ||||
echo "Starting the development environment" | echo "Starting the development environment" | ||||
rpm -qv composer >/dev/null 2>&1 || \ | rpm -qv composer >/dev/null 2>&1 || \ | ||||
test ! -z "$(which composer 2>/dev/null)" || \ | test ! -z "$(which composer 2>/dev/null)" || \ | ||||
die "Is composer installed?" | die "Is composer installed?" | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
if [ ! -f 'resources/countries.php' ]; then | if [ ! -f 'resources/countries.php' ]; then | ||||
./artisan data:countries | ./artisan data:countries | ||||
fi | fi | ||||
npm run dev | npm run dev | ||||
popd | popd | ||||
docker-compose up -d nginx | docker compose up -d nginx | ||||
pushd ${base_dir}/src/ | pushd ${base_dir}/src/ | ||||
rm -rf database/database.sqlite | rm -rf database/database.sqlite | ||||
./artisan db:ping --wait | ./artisan db:ping --wait | ||||
php -dmemory_limit=512M ./artisan migrate:refresh --seed | php -dmemory_limit=512M ./artisan migrate:refresh --seed | ||||
./artisan data:import || : | ./artisan data:import || : | ||||
nohup ./artisan octane:start --host=$(grep OCTANE_HTTP_HOST .env | tail -n1 | sed "s/OCTANE_HTTP_HOST=//") > octane.out & | nohup ./artisan octane:start --host=$(grep OCTANE_HTTP_HOST .env | tail -n1 | sed "s/OCTANE_HTTP_HOST=//") > octane.out & | ||||
nohup ./artisan horizon > horizon.out & | nohup ./artisan horizon > horizon.out & | ||||
popd | popd |