Changeset View
Changeset View
Standalone View
Standalone View
bin/quickstart.sh
Show All 21 Lines | |||||
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 | export DOCKER_BUILDKIT=0 | ||||
COMPOSE_ARGS= | |||||
if [ "$1" != "--nodev" ]; then | |||||
COMPOSE_ARGS="-f docker-compose.yml -f docker-compose.local.yml" | |||||
fi | |||||
docker-compose down --remove-orphans | docker-compose down --remove-orphans | ||||
docker volume rm kolab_mariadb || : | |||||
docker volume rm kolab_imap || : | |||||
docker volume rm kolab_ldap || : | |||||
if [ "$1" != "--nodev" ]; then | |||||
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 || : | ||||
else | |||||
docker-compose build coturn kolab mariadb meet pdns proxy redis haproxy | # If we switch from an existing development setup to a compose deployment, | ||||
# we don't have a nice way to terminate octane/horizon. | |||||
# We can't use the artisan command because it will just block if redis is, | |||||
# no longer available, so we just kill all artisan processes running. | |||||
pkill -9 -f artisan || : | |||||
fi | |||||
bin/regen-certs | bin/regen-certs | ||||
docker-compose build coturn kolab mariadb meet pdns proxy redis haproxy | |||||
docker-compose up -d coturn kolab mariadb meet pdns proxy redis haproxy | docker-compose ${COMPOSE_ARGS} up -d coturn kolab mariadb meet pdns 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 | ||||
container_state="$(docker inspect "${container_id}" --format '{{ .State.Status }}')" | container_state="$(docker inspect "${container_id}" --format '{{ .State.Status }}')" | ||||
if [[ "${container_state}" == "running" ]]; then | if [[ "${container_state}" == "running" ]]; then | ||||
health_status="$(docker inspect "${container_id}" --format '{{ .State.Health.Status }}')" | health_status="$(docker inspect "${container_id}" --format '{{ .State.Health.Status }}')" | ||||
echo "${container_name}: container_state=${container_state}, health_status=${health_status}" | echo "${container_name}: container_state=${container_state}, health_status=${health_status}" | ||||
if [[ ${health_status} == "healthy" ]]; then | if [[ ${health_status} == "healthy" ]]; then | ||||
waiting_done="true" | waiting_done="true" | ||||
fi | fi | ||||
else | else | ||||
echo "${container_name}: container_state=${container_state}" | echo "${container_name}: container_state=${container_state}" | ||||
waiting_done="true" | waiting_done="true" | ||||
fi | fi | ||||
sleep 1; | sleep 1; | ||||
done; | done; | ||||
} | } | ||||
# Ensure the containers we depend on are fully started | |||||
wait_for_container 'kolab' | |||||
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 | docker-compose -f docker-compose.build.yml build swoole | ||||
docker-compose build webapp | docker-compose build webapp | ||||
docker-compose up -d webapp proxy | docker-compose up -d webapp proxy haproxy | ||||
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 All 12 Lines | |||||
rpm -qv php-mysqlnd >/dev/null 2>&1 || \ | rpm -qv php-mysqlnd >/dev/null 2>&1 || \ | ||||
test ! -z "$(php --ini | grep mysql)" || \ | test ! -z "$(php --ini | grep mysql)" || \ | ||||
die "Is php-mysqlnd installed?" | die "Is php-mysqlnd installed?" | ||||
test ! -z "$(php --modules | grep swoole)" || \ | test ! -z "$(php --modules | grep swoole)" || \ | ||||
die "Is swoole installed?" | die "Is swoole installed?" | ||||
# Ensure the containers we depend on are fully started | |||||
wait_for_container 'kolab' | |||||
wait_for_container 'kolab-redis' | |||||
pushd ${base_dir}/src/ | pushd ${base_dir}/src/ | ||||
rm -rf vendor/ composer.lock | rm -rf vendor/ composer.lock | ||||
php -dmemory_limit=-1 $(which composer) install | php -dmemory_limit=-1 $(which composer) install | ||||
npm install | npm install | ||||
find bootstrap/cache/ -type f ! -name ".gitignore" -delete | find bootstrap/cache/ -type f ! -name ".gitignore" -delete | ||||
./artisan key:generate | ./artisan key:generate | ||||
./artisan clear-compiled | ./artisan clear-compiled | ||||
Show All 24 Lines | |||||
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 | ||||
docker-compose ${COMPOSE_ARGS} up --no-deps -d proxy haproxy |