Newer
Older
export USER_PASSWORD_HASH=$(echo -n "$(scw-userdata user_password)" | argon2 "$(echo $RANDOM | md5sum | head -c 12)" -id -l 32 -e)
Nathan Rodet
committed
export ATRIUM_COUNT_INDEX=$(scw-userdata atrium_count_index)
mkdir -p /root/atrium/data && mkdir -p /root/atrium/letsencrypt_cache
curl https://forge.grandlyon.com/systemes-dinformation/alpha/pocs/cloud-machinist/cloud-machinist-templates/scaleway-instances-template/-/raw/main/instance-scripts/config-files/atrium.yaml -o root/atrium/atrium.yaml
sed -i "s|%atrium_hostname%|$(scw-userdata atrium_hostname)|g" /root/atrium/atrium.yaml
sed -i "s|%project_domain%|$(scw-userdata project_domain)|g" /root/atrium/atrium.yaml
sed -i "s|%atrium_letsencrypt_email%|$(scw-userdata atrium_letsencrypt_email)|g" /root/atrium/atrium.yaml
Nathan Rodet
committed
if [ "$ATRIUM_COUNT_INDEX" -eq 0 ]; then
sed -i "s|%-atrium_count_index%||g" /root/atrium/atrium.yaml
echo "test1"
else
# Apply this if the value is greater than 0
sed -i "s|%-atrium_count_index%|-$(scw-userdata atrium_count_index)|g" /root/atrium/atrium.yaml
echo "test2"
fi
sed -i "s|%user_password_hash%|$USER_PASSWORD_HASH|g" /root/atrium/atrium.yaml
sed -i "s|%user_password%|$(scw-userdata user_password)|g" /root/atrium/atrium.yaml
chown -Rf 1000:1000 /root/atrium
#
# Run Atrium Container
#
docker run -d --name atrium \
--restart unless-stopped \
--net=host \
-v /root/atrium/atrium.yaml:/app/atrium.yaml \
-v /root/atrium/letsencrypt_cache:/app/letsencrypt_cache \
-v /root/atrium/data:/app/data nicolaspernoud/atrium:latest