Apps config

This commit is contained in:
Nicolas Meienberger 2022-03-29 21:26:52 +02:00
parent e5bd794778
commit b8004870dc
4 changed files with 36 additions and 2 deletions

View file

@ -5,7 +5,7 @@ services:
image: 'weejewel/wg-easy'
restart: unless-stopped
volumes:
- ${PWD}/wg-easy:/etc/wireguard
- ${DATA_FOLDER}/wg-easy:/etc/wireguard
environment:
WG_HOST: 'wireguard.meienberger.dev'
PASSWORD: 'moneyprintergobrrr'

View file

@ -22,6 +22,13 @@ ENV_FILE="./templates/.env"
[[ -f "./templates/.env-sample" ]] && cp "./templates/.env-sample" "$ENV_FILE"
[[ -f "./templates/ansible-hosts-sample.cfg" ]] && cp "./templates/ansible-hosts-sample.cfg" "$ANSIBLE_HOSTS_FILE"
# Install jq if not installed
if ! command -v jq > /dev/null; then
echo "Installing jq..."
apt-get update
apt-get install -y jq
fi
# Install ansible if not installed
if ! command -v ansible > /dev/null; then
echo "Installing Ansible..."

View file

@ -1,3 +1,6 @@
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
STATE_FOLDER="${ROOT_FOLDER}/state"
if [[ $UID != 0 ]]; then
echo "Tipi must be started as root"
echo "Please re-run this script as"
@ -5,4 +8,25 @@ if [[ $UID != 0 ]]; then
exit 1
fi
# run docker-compose
# Run docker-compose
# docker-compose up -d
# Get field from json file
function get_json_field() {
local json_file="$1"
local field="$2"
echo $(jq -r ".${field}" "${json_file}")
}
str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
apps_to_start=($str)
for app in "${apps_to_start[@]}"; do
echo "Starting app: $app"
# App data folder
app_data_folder="${UMBREL_ROOT}/app-data/${app}"
docker-compose -f ${ROOT_FOLDER}/apps/${app}/docker-compose.yml --env-file ${ROOT_FOLDER}/.env -e DATA_FOLDER=${app_data_folder} up -d
done

3
state/apps.json Normal file
View file

@ -0,0 +1,3 @@
{
"installed": "wg-easy"
}