[TOOLS] Update install scripts
This commit is contained in:
parent
988be9dbf1
commit
5a61098d28
2
.php_cs
2
.php_cs
|
@ -271,6 +271,8 @@ return PhpCsFixer\Config::create()
|
||||||
->setFinder(PhpCsFixer\Finder::create()
|
->setFinder(PhpCsFixer\Finder::create()
|
||||||
->exclude('vendor')
|
->exclude('vendor')
|
||||||
->exclude('var')
|
->exclude('var')
|
||||||
|
->exclude('docker')
|
||||||
->exclude('src/Entity')
|
->exclude('src/Entity')
|
||||||
|
->notPath('src/Core/DefaultSettings.php')
|
||||||
->in(__DIR__)
|
->in(__DIR__)
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,14 +4,17 @@ printf "Domain root: "
|
||||||
read -r domain_root
|
read -r domain_root
|
||||||
printf "Subdomain (can be empty): "
|
printf "Subdomain (can be empty): "
|
||||||
read -r sub_domain
|
read -r sub_domain
|
||||||
printf "Email: "
|
|
||||||
read -r email
|
|
||||||
printf "Use certificate signed by Let's Encrypt (Y/n): "
|
|
||||||
read -r signed
|
read -r signed
|
||||||
|
printf "Use certificate signed by Let's Encrypt (Y/n): "
|
||||||
|
|
||||||
[ "${signed}" = "${signed#[Yy]}" ]
|
[ "${signed}" = "${signed#[Yy]}" ]
|
||||||
signed=$?
|
signed=$?
|
||||||
|
|
||||||
|
if [ $signed ]; then
|
||||||
|
printf "Email: "
|
||||||
|
read -r email
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$sub_domain" ]
|
if [ -z "$sub_domain" ]
|
||||||
then
|
then
|
||||||
domain="${domain_root}"
|
domain="${domain_root}"
|
||||||
|
|
43
bin/configure
vendored
43
bin/configure
vendored
|
@ -1,22 +1,36 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
git_dir=$PWD
|
||||||
|
while [ ! -d .git ]; do
|
||||||
|
git_dir=$(dirname "${git_dir}")
|
||||||
|
done
|
||||||
|
|
||||||
|
cd "${git_dir}" || exit
|
||||||
|
|
||||||
. ./docker/bootstrap/bootstrap.env
|
. ./docker/bootstrap/bootstrap.env
|
||||||
|
|
||||||
read -p "DBMS (postgres|mariadb): " dbms
|
|
||||||
read -p "DB root password: " db_root_password
|
while :; do
|
||||||
read -p "Social database name: " db
|
printf "DBMS (postgres|mariadb): " && read -r dbms
|
||||||
read -p "Database user: " user
|
[ $(echo "${dbms}" | grep -E 'postgres|mariadb') ] && break
|
||||||
read -p "Database password: " password
|
done
|
||||||
read -p "Sitename: " sitename
|
|
||||||
read -p "Admin nickname: " admin_nick
|
printf "Social database name: " && read -r db
|
||||||
read -p "Admin password: " admin_password
|
[ "${dbms}" = 'mariadb' ] && printf "Database user: " && read -r user
|
||||||
read -p "Site profile (public|private|community|singleuser): " profile
|
printf "Database password: " && read -r password
|
||||||
|
printf "Sitename: " && read -r sitename
|
||||||
|
printf "Admin nickname: " && read -r admin_nick
|
||||||
|
printf "Admin password: " && read -r admin_password
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
printf "Site profile (public|private|community|singleuser): " && read -r profile
|
||||||
|
[ $(echo "${profile}" | grep -E 'public|private|community|singleuser') ] && break
|
||||||
|
done
|
||||||
|
|
||||||
mkdir -p ./docker/db
|
mkdir -p ./docker/db
|
||||||
|
|
||||||
|
if [ "${dbms}" = 'mariadb' ]; then
|
||||||
if [ ${dbms} = 'mariadb' ]; then
|
printf "DB root password: " && read -r db_root_password
|
||||||
read -p "DB root password: " db_root_password
|
|
||||||
cat > ./docker/db/db.env <<EOF
|
cat > ./docker/db/db.env <<EOF
|
||||||
DBMS=${dbms}
|
DBMS=${dbms}
|
||||||
MYSQL_ROOT_PASSWORD=${db_root_password}
|
MYSQL_ROOT_PASSWORD=${db_root_password}
|
||||||
|
@ -28,14 +42,15 @@ else
|
||||||
cat > ./docker/db/db.env <<EOF
|
cat > ./docker/db/db.env <<EOF
|
||||||
DBMS=${dbms}
|
DBMS=${dbms}
|
||||||
POSTGRES_USER=postgres
|
POSTGRES_USER=postgres
|
||||||
POSTGRES_PASSWORD=${db_root_password}
|
POSTGRES_PASSWORD=${password}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
user='postgres'
|
||||||
database_url="DATABASE_URL=postgresql://${user}:${password}@db:5432/${db}"
|
database_url="DATABASE_URL=postgresql://${user}:${password}@db:5432/${db}"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $database_url > .env.local
|
echo "${database_url}" > .env.local
|
||||||
|
|
||||||
mkdir -p ./docker/social
|
mkdir -p ./docker/social
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ then
|
||||||
-keyout "${lets_path}/live/${domain_root}/privkey.pem" \
|
-keyout "${lets_path}/live/${domain_root}/privkey.pem" \
|
||||||
-out "${lets_path}/live/${domain_root}/fullchain.pem" -subj "/CN=${domain_root}"
|
-out "${lets_path}/live/${domain_root}/fullchain.pem" -subj "/CN=${domain_root}"
|
||||||
|
|
||||||
nginx -s reload
|
|
||||||
else
|
else
|
||||||
echo "### Creating dummy certificate for ${domain_root} ..."
|
echo "### Creating dummy certificate for ${domain_root} ..."
|
||||||
openssl req -x509 -nodes -newkey rsa:1024 -days 1 \
|
openssl req -x509 -nodes -newkey rsa:1024 -days 1 \
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
case "${DBMS}" in
|
case "${DBMS}" in
|
||||||
'postgres')
|
'postgres')
|
||||||
PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
|
PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
|
||||||
cut -d '|' -f1 | grep -wq "${SOCIAL_DB}"
|
cut -d '|' -f1 | grep -Fwq "${SOCIAL_DB}"
|
||||||
DB_EXISTS=$?
|
DB_EXISTS=$?
|
||||||
;;
|
;;
|
||||||
'mariadb')
|
'mariadb')
|
||||||
mysqlcheck -cqs -uroot -p${MYSQL_ROOT_PASSWORD} -hdb social 2> /dev/null
|
mysqlcheck -cqs -uroot -p"${MYSQL_ROOT_PASSWORD}" -hdb social 2> /dev/null
|
||||||
DB_EXISTS=$?
|
DB_EXISTS=$?
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
@ -16,11 +16,12 @@ case "${DBMS}" in
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ ! ${DB_EXISTS} ]; then
|
if [ ${DB_EXISTS} -ne 0 ]; then
|
||||||
|
|
||||||
echo -e "Installing GNU social\nInstalling composer dependencies"
|
echo "Installing GNU social"
|
||||||
|
echo "Installing composer dependencies"
|
||||||
|
|
||||||
cd /var/www/social
|
cd /var/www/social || exit 1
|
||||||
|
|
||||||
composer install
|
composer install
|
||||||
|
|
||||||
|
@ -28,6 +29,9 @@ if [ ! ${DB_EXISTS} ]; then
|
||||||
chown -R :www-data .
|
chown -R :www-data .
|
||||||
|
|
||||||
php bin/console doctrine:database:create || exit 1
|
php bin/console doctrine:database:create || exit 1
|
||||||
|
php bin/console doctrine:schema:create || exit 1
|
||||||
|
|
||||||
echo "GNU social is installed"
|
echo "GNU social is installed"
|
||||||
|
else
|
||||||
|
echo "GNU social is already installed"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user