Skip to content

Commit

Permalink
Update deployment scripts for camvote
Browse files Browse the repository at this point in the history
  • Loading branch information
Root @ localhost committed Nov 9, 2022
1 parent 48ca8ff commit 89fb41f
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Ignore the log file
log.txt
bob/

# Ignore the instantiated copy of the config template
.config.sh
config.sh


14 changes: 7 additions & 7 deletions 1-install-base.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
# This script is idempotent - it can be safely re-run without destroying existing data


Expand Down Expand Up @@ -181,8 +181,8 @@ else
fi

# Create a vhost for the website if it doesn't exist already
vhostFile="${apacheVhostsConfigDirectory}/${domainName}.conf"
installationRoot="${apacheVhostsRoot}/${domainName}"
vhostFile="${apacheVhostsConfigDirectory}/camvote.conf"
installationRoot="${apacheVhostsRoot}/camvote"
if [ ! -r ${vhostFile} ]; then
cat > ${vhostFile} << EOF
## Voting website
Expand Down Expand Up @@ -236,9 +236,9 @@ php_admin_value memory_limit 512M
# SSL
SSLEngine on
SSLCertificateFile ${apacheSslCrtDirectory}/${domainName}.crt
SSLCertificateKeyFile ${apacheSslKeyDirectory}/${domainName}.key
${apacheSslCertificateChainDirective}
SSLCertificateFile ${sslCertificateCrt} #${apacheSslCrtDirectory}/${domainName}.crt
SSLCertificateKeyFile ${sslCertificateKey} #${apacheSslKeyDirectory}/${domainName}.key
SSLCertificateChainFile ${sslCertificateChain} # ${apacheSslCertificateChainDirective}
# Authentication
<Location />
Expand Down Expand Up @@ -295,7 +295,7 @@ a2enmod rewrite
a2enmod macro

# Enable the site and restart
a2ensite www.vote.cusu.cam.ac.uk
a2ensite iris.mxbi.net

# Create a group for web editors, who can edit the files
if ! grep -i "^${webEditorsGroup}\b" /etc/group > /dev/null 2>&1 ; then
Expand Down
2 changes: 1 addition & 1 deletion 2-install-bob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Add the BOB software (the native voting component, without any setup management)
if [ ! -d ${installationRoot}/bob ] ; then
cd "${installationRoot}"
git clone https://github.com/cusu/bob.git
git clone https://github.com/camvote/bob.git
cd "${SCRIPTDIRECTORY}"
fi

Expand Down
2 changes: 1 addition & 1 deletion 3-install-bob-gui-listing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Add the BOB-GUI software (the native voting component, without any setup management)
if [ ! -d ${installationRoot}/bob-gui ] ; then
cd "${installationRoot}"
git clone https://github.com/cusu/bob-gui.git
git clone https://github.com/camvote/bob-gui.git
cd "${SCRIPTDIRECTORY}"
fi

Expand Down
18 changes: 9 additions & 9 deletions 5-install-bob-gui-controlpanel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ apt-get -y install php7.2-mbstring
chown "${apacheUser}" "${installationRoot}"/bob-gui/controlpanel/logfile.txt

# Copy in the providers (directory) API
if [ ! -r "${providersApiFile}" ] ; then
echo "ERROR: The providers API file is not present"
exit 1
fi
if [ ! -e "${installationRoot}"/bob-gui/controlpanel/providers.php ] ; then
cp "${providersApiFile}" "${installationRoot}"/bob-gui/controlpanel/providers.php
chown "${apacheUser}"."${webEditorsGroup}" "${providersApiFile}"
chmod g+rw "${providersApiFile}"
fi
#if [ ! -r "${providersApiFile}" ] ; then
# echo "ERROR: The providers API file is not present"
# exit 1
#fi
#if [ ! -e "${installationRoot}"/bob-gui/controlpanel/providers.php ] ; then
# cp "${providersApiFile}" "${installationRoot}"/bob-gui/controlpanel/providers.php
# chown "${apacheUser}"."${webEditorsGroup}" "${providersApiFile}"
# chmod g+rw "${providersApiFile}"
#fi

# Limit to specific users by adding an .htaccess file
if [ -n "$controlPanelOnlyUsers" ]; then
Expand Down
4 changes: 4 additions & 0 deletions 6-camvote-specific.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git clone https://github.com/camvote/bob-providers.git /var/www/iris.mxbi.net/bob-gui/controlpanel/providers

# If you're ok with overwriting the existing one
# cp ssh-config ~/.ssh/config
File renamed without changes.
3 changes: 2 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fi

# Bomb out if something goes wrong
set -e
set -x

# Get the script directory see: http://stackoverflow.com/a/246128/180733
# The second single line solution from that page is probably good enough as it is unlikely that this script itself will be symlinked.
Expand All @@ -24,7 +25,7 @@ SCRIPTDIRECTORY=$DIR
cd "${SCRIPTDIRECTORY}"

# Load the config file
configFile=./.config.sh
configFile=./config.sh
if [ ! -x ./${configFile} ]; then
echo "ERROR: The config file, ${configFile}, does not exist or is not excutable - copy your own based on the ${configFile}.template file." 1>&2
exit 1
Expand Down
11 changes: 11 additions & 0 deletions ssh-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Host git-bob
Hostname github.com
IdentityFile /home/user/.ssh/bob

Host git-bob-gui
Hostname github.com
IdentityFile /home/user/.ssh/bob-gui

Host git-bob-gui-deploy
Hostname github.com
IdentityFile /home/user/.ssh/bob-gui-deploy

0 comments on commit 89fb41f

Please sign in to comment.