[TOOLS] Added script to configure the installation and to bootstrap certificate creation with Let's Encrypt

This commit is contained in:
Hugo Sales 2020-05-06 11:57:32 +00:00 committed by Hugo Sales
parent e0b26ad38b
commit cf1a9fe893
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
4 changed files with 74 additions and 50 deletions

21
bin/bootstrap_certificates Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
read -p "Domain root: " domain_root
read -p "Subdomain (can be empty): " sub_domain
read -p "Email: " email
if [ -z $sub_domain ]; then
domain="${domain_root}"
else
domain="${sub_domain}.${domain_root}"
fi
mkdir -p ./docker/bootstrap
cat > ./docker/bootstrap/bootstrap.env <<EOF
email=${email}
domain=${domain}
domain_root=${domain_root}
EOF
docker-compose -f docker/bootstrap/bootstrap.yaml up

View File

@ -1,40 +0,0 @@
#!/bin/sh
echo "Domain: "
read doamin
echo "Email: "
read email
cat > ../docker/bootstrap/bootstrap.env <<EOF
email=${email}
domain=${domain}
EOF
echo "Social database name: "
read db
echo "Database user: "
read user
echo "Database password: "
read password
echo "Sitename: "
read sitename
echo "Admin nickname: "
read admin_nick
echo "Admin password: "
read admin_password
echo "Site profile (public|private|community|singleuser): "
read profile
cat > ../docker/social/social.env <<EOF
SOCIAL_DB=${db}
SOCIAL_USER=${user}
SOCIAL_PASSWORD=${password}
SOCIAL_DOMAIN=${domain}
SOCIAL_SITENAME=${sitename}
SOCIAL_ADMIN_NICK=${nick}
SOCIAL_ADMIN_PASSWORD=${admin_password}
SOCIAL_ADMIN_EMAIL=${email}
SOCIAL_SITE_PROFILE=${profile}
EOF
docker-compose -f docker/bootstrap/bootstrap.yaml up

53
bin/configure vendored Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh
. ./docker/bootstrap/bootstrap.env
read -p "DBMS (postgres|mariadb): " dbms
read -p "DB root password: " db_root_password
read -p "Social database name: " db
read -p "Database user: " user
read -p "Database password: " password
read -p "Sitename: " sitename
read -p "Admin nickname: " admin_nick
read -p "Admin password: " admin_password
read -p "Site profile (public|private|community|singleuser): " profile
mkdir -p ./docker/db
if [ ${dbms} = 'mariadb' ]; then
read -p "DB root password: " db_root_password
cat > ./docker/db/db.env <<EOF
DBMS=${dbms}
MYSQL_ROOT_PASSWORD=${db_root_password}
EOF
database_url="DATABASE_URL=mysql://${user}:${password}@db:3306/${db}"
else
cat > ./docker/db/db.env <<EOF
DBMS=${dbms}
POSTGRES_USER=postgres
POSTGRES_PASSWORD=${db_root_password}
EOF
database_url="DATABASE_URL=postgresql://${user}:${password}@db:5432/${db}"
fi
echo $database_url > .env.local
mkdir -p ./docker/social
cat > ./docker/social/social.env <<EOF
SOCIAL_DBMS=${dbms}
SOCIAL_DB=${db}
SOCIAL_USER=${user}
SOCIAL_PASSWORD=${password}
SOCIAL_DOMAIN=${domain}
SOCIAL_SITENAME=${sitename}
SOCIAL_ADMIN_NICK=${admin_nick}
SOCIAL_ADMIN_PASSWORD=${admin_password}
SOCIAL_ADMIN_EMAIL=${email}
SOCIAL_SITE_PROFILE=${profile}
EOF

View File

@ -1,10 +0,0 @@
#!/bin/sh
SOCIAL_DB=social
SOCIAL_USER=social
SOCIAL_PASSWORD=foobar
SOCIAL_DOMAIN=social.hsal.es
SOCIAL_SITENAME="Test instance"
SOCIAL_ADMIN_NICK=foo
SOCIAL_ADMIN_PASSWORD=foobar
SOCIAL_SITE_PROFILE=public