template-backend/bin/script/init
2024-02-14 20:12:27 +01:00

32 lines
856 B
Bash
Executable File

#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_DIR=$(realpath $SCRIPT_DIR/../../)
ENV_DIR=$(realpath $PROJECT_DIR/../../)
# Check .env file
if [ ! -f "$PROJECT_DIR/.env" ]
then
echo "Create .env file from example..."
cp "$PROJECT_DIR/.env.example" "$PROJECT_DIR/.env"
echo ".env file created, please change variables and call me again"
exit 1
fi
# Build and start docker containers
$SCRIPT_DIR/exec build
$SCRIPT_DIR/exec up -d
# Source drun
source $ENV_DIR/bin/script/drun
# Install PHP packages
drun template-backend composer install
# Migrate databases to current version
drun template-backend composer dmm
drun template-backend composer dmlm
# Insert setup for project after this line
drun template-backend composer console rbac:update
drun template-backend composer console init:data