#!/bin/bash

# go into the app dir
cd /root

# fetch nginx and docker-compose files
wget https://raw.githubusercontent.com/Budibase/budibase/master/hosting/docker-compose.yaml
wget https://raw.githubusercontent.com/Budibase/budibase/master/hosting/hosting.properties

# Create .env file from hosting.properties using bash and then remove it
while read line; do
		uuid=$(uuidgen)
		echo $line | sed "s/budibase/$uuid/g" | sed "s/testsecret/$uuid/g" >> .env
done <hosting.properties
rm hosting.properties

# boot the stack
docker-compose up -d

# return
cd -