-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from PruthviKumarBK/feature/PR-130-away-from-p…
…roton-vars Feature/pr 130 away from proton vars
- Loading branch information
Showing
5 changed files
with
62 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,13 +65,13 @@ if [[ ! -z ${dns} ]]; then | |
echo -e "[Step - 1] Installing Docker & Docker-Compose\n" | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y docker # needs to be tested | ||
sudo apt-get install -y docker-compose # Needs to be tested | ||
sudo apt-get install -y docker docker-compose | ||
echo -e "\n" | ||
|
||
# Enable $USER to run docker | ||
echo -e "[Step -1a] Enabling ${USER_NAME} to run docker\n" | ||
sudo usermod -a -G docker ${USER_NAME} | ||
sudo groupadd docker | ||
sudo usermod -aG docker ${USER_NAME} | ||
echo -e "\n" | ||
|
||
# Install nginx and http reverse proxy to PROTON | ||
|
@@ -98,6 +98,7 @@ EOT | |
sudo ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf | ||
sudo nginx -t | ||
sudo service nginx restart | ||
cd ${ROOT_DIR} | ||
echo -e "\n" | ||
|
||
# Configure HTTPS and reverse proxy HTTPS as default to PROTON. | ||
|
@@ -110,25 +111,25 @@ EOT | |
sudo certbot --nginx --non-interactive --agree-tos -m [email protected] -d ${dns} | ||
echo -e "\n" | ||
|
||
# Avoiding permission issues for PROTON stack. | ||
echo -e "[Step - 4] Granting PROTON stack with required folder level permissions." | ||
cd ${ROOT_DIR} | ||
sudo chmod 777 -R ./ | ||
echo -e "\n" | ||
|
||
echo -e "Infrastructure prep completed for PROTON\n" | ||
sudo newgrp docker | ||
newgrp docker | ||
fi | ||
|
||
if [[ ${automated} == 'yes' ]]; then | ||
echo -e "DEPLOYER is proceeding in AUTOMATED mode\n" | ||
echo -e "Generating platform config here - ${ROOT_DIR}\n" | ||
|
||
# Assumption - Before this section, ./deployer -a <dns> is presumed to have run. This would have changed user to root. | ||
NON_ROOT_USER=`echo ${SUDO_USER:-${USER}}` | ||
# Reject if running as root. | ||
if [[ ${EUID} != 0 ]]; then | ||
: | ||
else | ||
NON_ROOT_USER=`echo ${SUDO_USER:-${USER}}` | ||
echo -e "Cannot proceed as root. Please re-issue this command as ${NON_ROOT_USER}\n" | ||
exit 1 | ||
fi | ||
|
||
# Volume mounts to live in ORIGINAL user's home directory. | ||
cd /home/${NON_ROOT_USER} | ||
cd /home/${USER} | ||
mkdir -p proton_db | ||
cd proton_db | ||
echo -e "Generating mount paths for proton databases here - $(pwd)" | ||
|
@@ -140,11 +141,12 @@ if [[ ${automated} == 'yes' ]]; then | |
mkdir -p redis | ||
|
||
echo -e "Granting permissions for Proton databases." | ||
cd .. | ||
sudo chmod 777 -R ./ | ||
cd /home/${USER} | ||
sudo chown -R $(id -u):$(id -g) /home/${USER}/proton_db | ||
|
||
echo -e "Generating PROTONs core .env" | ||
cd ${ROOT_DIR} | ||
|
||
cat << EOF > .env | ||
# PS: ANY CHANGES HERE WILL AFFECT BUILD PROCESS. | ||
# PS: DO NOT DELETE ANY VARIABLES OR RENAME THEM. PROTON'S CONTAINERS RELY ON THESE VARIABLES. | ||
|
@@ -162,7 +164,7 @@ PROTON_POSTGRES_VOLUME_MOUNT=${AUTOMATED_PROTON_DB_PATH}/pg | |
PROTON_REDIS_VOLUME_MOUNT=${AUTOMATED_PROTON_DB_PATH}/redis | ||
SENDGRID_API_KEY=NA | ||
EOF | ||
|
||
sudo chown -R $(id -u):$(id -g) ./ | ||
echo -e "Initializing PROTON Stack\n" | ||
./cproton.sh -U yes | ||
echo -e "\n" | ||
|
@@ -181,7 +183,18 @@ EOF | |
fi | ||
if [[ ${restore} == 'yes' ]]; then | ||
echo -e "Deployer is instantiating PROTON Restore. Restoration is an interactive process. Please help with valid inputs." | ||
echo -e "********* PS: Please only use this mount path for PROTON restoration: /tmp/proton_restore *********\n" | ||
echo -e "***************************************************************************************************************" | ||
echo -e "*********** PS: Please only use this mount path for PROTON restoration: /tmp/proton_restore ******************" | ||
echo -e "***************************************************************************************************************\n" | ||
|
||
# Reject if running as root. | ||
if [[ ${EUID} != 0 ]]; then | ||
: | ||
else | ||
NON_ROOT_USER=`echo ${SUDO_USER:-${USER}}` | ||
echo -e "Cannot proceed as root. Please re-issue this command as ${NON_ROOT_USER}\n" | ||
exit 1 | ||
fi | ||
|
||
sudo apt-get install -y python-pip | ||
pip install dropbox | ||
|
@@ -199,19 +212,16 @@ if [[ ${restore} == 'yes' ]]; then | |
cd ${ROOT_DIR} | ||
mv -f ${PROTON_RESTORE_LOCATION}/.env ./ | ||
|
||
# Assumption - Before this section, ./deployer -a <dns> is presumed to have run. This would have changed user to root. | ||
NON_ROOT_USER=`echo ${SUDO_USER:-${USER}}` | ||
|
||
cd /home/${NON_ROOT_USER} | ||
cd /home/${USER} | ||
mkdir -p proton_db | ||
cd proton_db | ||
cd /home/${USER}/proton_db | ||
rm -rf ./* | ||
|
||
mv -f ${PROTON_RESTORE_LOCATION}/pg ./ | ||
mv -f ${PROTON_RESTORE_LOCATION}/redis ./ | ||
mv -f ${PROTON_RESTORE_LOCATION}/sqlite ./ | ||
cd .. | ||
sudo chmod -R 777 ./* | ||
|
||
sudo chown -R $(id -u):$(id -g) /home/${USER}/proton_db | ||
|
||
cd ${ROOT_DIR} | ||
|
||
|
@@ -228,9 +238,9 @@ if [[ ${restore} == 'yes' ]]; then | |
|
||
rm -rf ./.env | ||
|
||
PROTON_SQLITE_VOLUME_MOUNT=/home/${NON_ROOT_USER}/proton_db/sqlite | ||
PROTON_POSTGRES_VOLUME_MOUNT=/home/${NON_ROOT_USER}/proton_db/pg | ||
PROTON_REDIS_VOLUME_MOUNT=/home/${NON_ROOT_USER}/proton_db/redis | ||
PROTON_SQLITE_VOLUME_MOUNT=/home/${USER}/proton_db/sqlite | ||
PROTON_POSTGRES_VOLUME_MOUNT=/home/${USER}/proton_db/pg | ||
PROTON_REDIS_VOLUME_MOUNT=/home/${USER}/proton_db/redis | ||
|
||
cat << EOF > .env | ||
# PS: ANY CHANGES HERE WILL AFFECT BUILD PROCESS. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters