35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
cd /opt/opengnsys/ogCore/repo/
|
|
|
|
if [ -f /opt/opengnsys/ogCore/installer/.deployed ]; then
|
|
echo "ogCore ya instalado"
|
|
exit 0
|
|
fi
|
|
|
|
while ! docker compose -f docker-compose-deploy.yml ps --format json |jq -r '.["Name"] + " " + .["State"]' |grep -q 'ogcore-php running'; do
|
|
sleep 2
|
|
done
|
|
|
|
adminuser=$(jq -r '.username' /opt/opengnsys/ogCore/installer/config.json)
|
|
adminpass=$(jq -r '.password' /opt/opengnsys/ogCore/installer/config.json)
|
|
|
|
docker compose -f docker-compose-deploy.yml exec php composer install
|
|
docker compose -f docker-compose-deploy.yml exec php php bin/console lexik:jwt:generate-keypair --overwrite
|
|
docker compose -f docker-compose-deploy.yml exec php php bin/console doctrine:migrations:migrate --no-interaction
|
|
## TODO we need to feed $adminuser and $adminpass to doctrine:fixtures:load somehow
|
|
docker compose -f docker-compose-deploy.yml exec php php bin/console doctrine:fixtures:load --no-interaction
|
|
|
|
|
|
# Provision user admin
|
|
curl -k -X 'POST' \
|
|
'https://localhost:8443/auth/login' \
|
|
-H 'accept: application/json' \
|
|
-H 'Content-Type: application/json' \
|
|
-d "{
|
|
\"username\": \"$adminuser\",
|
|
\"password\": \"$adminpass\"
|
|
}"
|
|
|
|
touch /opt/opengnsys/ogCore/installer/.deployed
|