Make SOURCE_DIR always refer to the current app source directory

This commit is contained in:
Disassembler 2017-12-04 17:48:37 +01:00
parent b005ff3aec
commit 7dd9adce0d
15 changed files with 8652 additions and 112 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
# Uninstall unnecessary packages # Uninstall unnecessary packages
@ -18,13 +18,13 @@ apt-get -y --no-install-recommends install apt-transport-https bash-completion c
# Install OpenSSH server # Install OpenSSH server
apt-get -y --no-install-recommends install openssh-server apt-get -y --no-install-recommends install openssh-server
mkdir ~/.ssh mkdir ~/.ssh
cp ${SOURCE_DIR}/basic/root/.ssh/authorized_keys /root/.ssh/authorized_keys cp ${SOURCE_DIR}/root/.ssh/authorized_keys /root/.ssh/authorized_keys
# Copy profile files and settings # Copy profile files and settings
mkdir -p /root/.config/htop mkdir -p /root/.config/htop
cp ${SOURCE_DIR}/basic/root/.bashrc /root/.bashrc cp ${SOURCE_DIR}/root/.bashrc /root/.bashrc
cp ${SOURCE_DIR}/basic/root/.config/htop/htoprc /root/.config/htop/htoprc cp ${SOURCE_DIR}/root/.config/htop/htoprc /root/.config/htop/htoprc
cp ${SOURCE_DIR}/basic/root/.vimrc /root/.vimrc cp ${SOURCE_DIR}/root/.vimrc /root/.vimrc
# Remove default user # Remove default user
deluser --remove-all-files user 2>/dev/null deluser --remove-all-files user 2>/dev/null
@ -39,19 +39,19 @@ sed -i 's/sda2_crypt/system/' /etc/crypttab
dmsetup rename sda2_crypt system dmsetup rename sda2_crypt system
# Suppress warnings during boot # Suppress warnings during boot
cp ${SOURCE_DIR}/basic/usr/share/initramfs-tools/scripts/local-top/lvm2 /usr/share/initramfs-tools/scripts/local-top/lvm2 cp ${SOURCE_DIR}/usr/share/initramfs-tools/scripts/local-top/lvm2 /usr/share/initramfs-tools/scripts/local-top/lvm2
cp ${SOURCE_DIR}/basic/usr/share/initramfs-tools/scripts/local-top/cryptroot /usr/share/initramfs-tools/scripts/local-top/cryptroot cp ${SOURCE_DIR}/usr/share/initramfs-tools/scripts/local-top/cryptroot /usr/share/initramfs-tools/scripts/local-top/cryptroot
# Set GRUB options # Set GRUB options
cp ${SOURCE_DIR}/basic/etc/default/grub /etc/default/grub cp ${SOURCE_DIR}/etc/default/grub /etc/default/grub
# Set legal banner with URL + latin2 character set # Set legal banner with URL + latin2 character set
cp ${SOURCE_DIR}/basic/etc/default/console-setup /etc/default/console-setup cp ${SOURCE_DIR}/etc/default/console-setup /etc/default/console-setup
cp ${SOURCE_DIR}/basic/etc/issue /etc/issue cp ${SOURCE_DIR}/etc/issue /etc/issue
dpkg-reconfigure console-setup dpkg-reconfigure console-setup
# Forbid login on tty1, disable tty2-6 # Forbid login on tty1, disable tty2-6
cp ${SOURCE_DIR}/basic/lib/systemd/system/getty@.service /lib/systemd/system/getty@.service cp ${SOURCE_DIR}/lib/systemd/system/getty@.service /lib/systemd/system/getty@.service
systemctl mask getty-static systemctl mask getty-static
# Update initramfs and GRUB # Update initramfs and GRUB
@ -72,7 +72,7 @@ echo postfix postfix/relayhost string "" | debconf-set-selections
apt-get -y --no-install-recommends install postfix apt-get -y --no-install-recommends install postfix
# Configure Postfix # Configure Postfix
cp ${SOURCE_DIR}/basic/etc/postfix/main.cf /etc/postfix/main.cf cp ${SOURCE_DIR}/etc/postfix/main.cf /etc/postfix/main.cf
# Restart services # Restart services
systemctl restart postfix systemctl restart postfix
@ -92,15 +92,15 @@ chmod 640 /etc/ssl/private/services.key
# Configure nginx # Configure nginx
mkdir /etc/nginx/apps-available /etc/nginx/apps-enabled mkdir /etc/nginx/apps-available /etc/nginx/apps-enabled
cp ${SOURCE_DIR}/basic/etc/nginx/nginx.conf /etc/nginx/nginx.conf cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf
cp ${SOURCE_DIR}/basic/etc/nginx/sites-available/default /etc/nginx/sites-available/default cp ${SOURCE_DIR}/etc/nginx/sites-available/default /etc/nginx/sites-available/default
# Workaround for web2py shutdown problem, see https://github.com/web2py/web2py/issues/1769 # Workaround for web2py shutdown problem, see https://github.com/web2py/web2py/issues/1769
sed -i 's|QUIT/30|QUIT/5|' /usr/share/uwsgi/init/specific_daemon sed -i 's|QUIT/30|QUIT/5|' /usr/share/uwsgi/init/specific_daemon
# Copy Portal resources # Copy Portal resources
cp -r ${SOURCE_DIR}/basic/usr/local/bin/portal-app-manager /usr/local/bin/portal-app-manager cp -r ${SOURCE_DIR}/usr/local/bin/portal-app-manager /usr/local/bin/portal-app-manager
cp -r ${SOURCE_DIR}/basic/srv/portal /srv/portal cp -r ${SOURCE_DIR}/srv/portal /srv/portal
chown -R www-data:www-data /srv/portal chown -R www-data:www-data /srv/portal
# Restart # Restart
@ -121,8 +121,8 @@ chown root:root /usr/share/postgresql/9.6/tsearch_data/czech.*
rm -f /tmp/czech.tar.gz rm -f /tmp/czech.tar.gz
# Configure # Configure
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf cp ${SOURCE_DIR}/etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf cp ${SOURCE_DIR}/etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf
# Enable query logging. Only if the DEBUG environment variable is set # Enable query logging. Only if the DEBUG environment variable is set
if [ ${DEBUG:-0} -eq 1 ]; then if [ ${DEBUG:-0} -eq 1 ]; then

32
ckan.sh
View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan
# Install dependencies for CKAN # Install dependencies for CKAN
apt-get -y --no-install-recommends install gcc libpq-dev python-dev python-virtualenv redis-server virtualenv apt-get -y --no-install-recommends install gcc libpq-dev python-dev python-virtualenv redis-server virtualenv
@ -22,7 +22,7 @@ virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/ckan-datapusher
# Patch service provider TLS verification for Datapusher # Patch service provider TLS verification for Datapusher
# https://github.com/ckan/ckan-service-provider/issues/36 # https://github.com/ckan/ckan-service-provider/issues/36
patch -d /srv/ckan-datapusher -p0 <${SOURCE_DIR}/ckan/ckan-serviceprovider-sslverify.patch patch -d /srv/ckan-datapusher -p0 <${SOURCE_DIR}/ckan-serviceprovider-sslverify.patch
# Install CKAN extensions # Install CKAN extensions
/srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckanext-basiccharts#egg=ckanext_basiccharts' /srv/ckan/bin/pip install -e 'git+https://github.com/ckan/ckanext-basiccharts#egg=ckanext_basiccharts'
@ -48,7 +48,7 @@ adduser --system --group --home /var/lib/solr --shell /bin/false solr
chown -R solr:solr /opt/solr/ chown -R solr:solr /opt/solr/
# Configure Solr # Configure Solr
cp ${SOURCE_DIR}/ckan/lib/systemd/system/solr.service /lib/systemd/system/solr.service cp ${SOURCE_DIR}/lib/systemd/system/solr.service /lib/systemd/system/solr.service
cp -p /opt/solr/server/solr/solr.xml /var/lib/solr/ cp -p /opt/solr/server/solr/solr.xml /var/lib/solr/
systemctl daemon-reload systemctl daemon-reload
systemctl enable solr systemctl enable solr
@ -57,14 +57,14 @@ sleep 5
# Configure CKAN Solr core # Configure CKAN Solr core
sudo -u solr /opt/solr/bin/solr create -c ckan sudo -u solr /opt/solr/bin/solr create -c ckan
cp ${SOURCE_DIR}/ckan/var/lib/solr/ckan/conf/solrconfig.xml /var/lib/solr/ckan/conf/solrconfig.xml cp ${SOURCE_DIR}/var/lib/solr/ckan/conf/solrconfig.xml /var/lib/solr/ckan/conf/solrconfig.xml
ln -s /srv/ckan/src/ckan/ckan/config/solr/schema.xml /var/lib/solr/ckan/conf/schema.xml ln -s /srv/ckan/src/ckan/ckan/config/solr/schema.xml /var/lib/solr/ckan/conf/schema.xml
systemctl restart solr systemctl restart solr
# Create database # Create database
export CKAN_PWD=$(head -c 18 /dev/urandom | base64) export CKAN_PWD=$(head -c 18 /dev/urandom | base64)
export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64) export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/ckan/tmp/ckan-createdb.sql >/tmp/ckan-createdb.sql envsubst <${SOURCE_DIR}/tmp/ckan-createdb.sql >/tmp/ckan-createdb.sql
sudo -u postgres psql -f /tmp/ckan-createdb.sql sudo -u postgres psql -f /tmp/ckan-createdb.sql
rm -f /tmp/ckan-createdb.sql rm -f /tmp/ckan-createdb.sql
@ -72,11 +72,11 @@ rm -f /tmp/ckan-createdb.sql
export CKAN_SECRET=$(head -c 18 /dev/urandom | base64) export CKAN_SECRET=$(head -c 18 /dev/urandom | base64)
export CKAN_UUID=$(python -c "import uuid; print uuid.uuid4()") export CKAN_UUID=$(python -c "import uuid; print uuid.uuid4()")
mkdir /etc/ckan mkdir /etc/ckan
envsubst <${SOURCE_DIR}/ckan/etc/ckan/ckan.ini >/etc/ckan/ckan.ini envsubst <${SOURCE_DIR}/etc/ckan/ckan.ini >/etc/ckan/ckan.ini
cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher.wsgi /etc/ckan/datapusher.wsgi cp ${SOURCE_DIR}/etc/ckan/datapusher.wsgi /etc/ckan/datapusher.wsgi
cp ${SOURCE_DIR}/ckan/etc/ckan/datapusher_settings.py /etc/ckan/datapusher_settings.py cp ${SOURCE_DIR}/etc/ckan/datapusher_settings.py /etc/ckan/datapusher_settings.py
ln -s /srv/ckan/src/ckan/ckan/config/who.ini /etc/ckan/who.ini ln -s /srv/ckan/src/ckan/ckan/config/who.ini /etc/ckan/who.ini
cp ${SOURCE_DIR}/ckan/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh cp ${SOURCE_DIR}/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh
/srv/ckan/update-ip.sh /srv/ckan/update-ip.sh
# Populate database # Populate database
@ -94,18 +94,18 @@ export CKAN_ADMIN_USER="admin"
export CKAN_ADMIN_UUID=$(python -c "import uuid; print uuid.uuid4()") export CKAN_ADMIN_UUID=$(python -c "import uuid; print uuid.uuid4()")
export CKAN_ADMIN_APIKEY=$(python -c "import uuid; print uuid.uuid4()") export CKAN_ADMIN_APIKEY=$(python -c "import uuid; print uuid.uuid4()")
export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export CKAN_ADMIN_HASH=$(/srv/ckan/bin/python ${SOURCE_DIR}/ckan/ckan-adminpwd.py ${CKAN_ADMIN_PWD}) export CKAN_ADMIN_HASH=$(/srv/ckan/bin/python ${SOURCE_DIR}/ckan-adminpwd.py ${CKAN_ADMIN_PWD})
export CKAN_ADMIN_EMAIL="admin@example.com" export CKAN_ADMIN_EMAIL="admin@example.com"
envsubst <${SOURCE_DIR}/ckan/tmp/ckan-adminpwd.sql >/tmp/ckan-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/ckan-adminpwd.sql >/tmp/ckan-adminpwd.sql
sudo -u postgres psql -f /tmp/ckan-adminpwd.sql ckan sudo -u postgres psql -f /tmp/ckan-adminpwd.sql ckan
rm /tmp/ckan-adminpwd.sql rm /tmp/ckan-adminpwd.sql
# Create uwsgi and nginx app definition # Create uwsgi and nginx app definition
cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-available/ckan.ini cp ${SOURCE_DIR}/etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-available/ckan.ini
cp ${SOURCE_DIR}/ckan/etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-available/ckan-datapusher.ini cp ${SOURCE_DIR}/etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-available/ckan-datapusher.ini
ln -s /etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-enabled/ckan.ini ln -s /etc/uwsgi/apps-available/ckan.ini /etc/uwsgi/apps-enabled/ckan.ini
ln -s /etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-enabled/ckan-datapusher.ini ln -s /etc/uwsgi/apps-available/ckan-datapusher.ini /etc/uwsgi/apps-enabled/ckan-datapusher.ini
cp ${SOURCE_DIR}/ckan/etc/nginx/sites-available/ckan /etc/nginx/sites-available/ckan cp ${SOURCE_DIR}/etc/nginx/sites-available/ckan /etc/nginx/sites-available/ckan
ln -s /etc/nginx/sites-available/ckan /etc/nginx/sites-enabled/ckan ln -s /etc/nginx/sites-available/ckan /etc/nginx/sites-enabled/ckan
# Restart services # Restart services
@ -113,8 +113,8 @@ systemctl restart uwsgi
systemctl restart nginx systemctl restart nginx
# Install cron job # Install cron job
cp ${SOURCE_DIR}/ckan/srv/ckan/cron-pageviews.sh /srv/ckan/cron-pageviews.sh cp ${SOURCE_DIR}/srv/ckan/cron-pageviews.sh /srv/ckan/cron-pageviews.sh
cp ${SOURCE_DIR}/ckan/etc/cron.d/ckan /etc/cron.d/ckan cp ${SOURCE_DIR}/etc/cron.d/ckan /etc/cron.d/ckan
# Add portal application definition # Add portal application definition
portal-app-manager ckan "https://{host}:8003/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}" portal-app-manager ckan "https://{host}:8003/" "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/crisiscleanup
# Add NodeJS + Yarn repositories # Add NodeJS + Yarn repositories
wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O - | apt-key add - wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O - | apt-key add -
@ -31,7 +31,7 @@ sudo -u crisis -i yarn
# Create database # Create database
export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64) export CRISISCLEANUP_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/crisiscleanup/tmp/crisiscleanup-createdb.sql >/tmp/crisiscleanup-createdb.sql envsubst <${SOURCE_DIR}/tmp/crisiscleanup-createdb.sql >/tmp/crisiscleanup-createdb.sql
sudo -u postgres psql -f /tmp/crisiscleanup-createdb.sql sudo -u postgres psql -f /tmp/crisiscleanup-createdb.sql
rm /tmp/crisiscleanup-createdb.sql rm /tmp/crisiscleanup-createdb.sql
@ -40,12 +40,12 @@ export CRISISCLEANUP_SECRET=$(sudo -u crisis -i /srv/crisiscleanup/bin/rake secr
export CRISISCLEANUP_ADMIN_USER="Admin" export CRISISCLEANUP_ADMIN_USER="Admin"
export CRISISCLEANUP_ADMIN_EMAIL="admin@example.com" export CRISISCLEANUP_ADMIN_EMAIL="admin@example.com"
export CRISISCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CRISISCLEANUP_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/config/database.yml >/srv/crisiscleanup/config/database.yml envsubst <${SOURCE_DIR}/srv/crisiscleanup/config/database.yml >/srv/crisiscleanup/config/database.yml
envsubst <${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/config/secrets.yml >/srv/crisiscleanup/config/secrets.yml envsubst <${SOURCE_DIR}/srv/crisiscleanup/config/secrets.yml >/srv/crisiscleanup/config/secrets.yml
envsubst <${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/config/initializers/devise.rb >/srv/crisiscleanup/config/initializers/devise.rb envsubst <${SOURCE_DIR}/srv/crisiscleanup/config/initializers/devise.rb >/srv/crisiscleanup/config/initializers/devise.rb
envsubst <${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/db/seeds.rb >/srv/crisiscleanup/db/seeds.rb envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/srv/crisiscleanup/db/seeds.rb
cp ${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/config/environments/production.rb /srv/crisiscleanup/config/environments/production.rb cp ${SOURCE_DIR}/srv/crisiscleanup/config/environments/production.rb /srv/crisiscleanup/config/environments/production.rb
cp ${SOURCE_DIR}/crisiscleanup/srv/crisiscleanup/.env /srv/crisiscleanup/.env cp ${SOURCE_DIR}/srv/crisiscleanup/.env /srv/crisiscleanup/.env
rm /srv/crisiscleanup/.env.test rm /srv/crisiscleanup/.env.test
sudo -u crisis -i /srv/crisiscleanup/bin/rake assets:precompile RAILS_ENV=production sudo -u crisis -i /srv/crisiscleanup/bin/rake assets:precompile RAILS_ENV=production
@ -54,11 +54,11 @@ sudo -u crisis -i /srv/crisiscleanup/bin/rake db:schema:load RAILS_ENV=productio
sudo -u crisis -i /srv/crisiscleanup/bin/rake db:seed RAILS_ENV=production sudo -u crisis -i /srv/crisiscleanup/bin/rake db:seed RAILS_ENV=production
# Create Rails service # Create Rails service
cp ${SOURCE_DIR}/crisiscleanup/lib/systemd/system/crisiscleanup.service /lib/systemd/system/crisiscleanup.service cp ${SOURCE_DIR}/lib/systemd/system/crisiscleanup.service /lib/systemd/system/crisiscleanup.service
systemctl daemon-reload systemctl daemon-reload
# Create nginx site definition # Create nginx site definition
cp ${SOURCE_DIR}/crisiscleanup/etc/nginx/sites-available/crisiscleanup /etc/nginx/sites-available/crisiscleanup cp ${SOURCE_DIR}/etc/nginx/sites-available/crisiscleanup /etc/nginx/sites-available/crisiscleanup
ln -s /etc/nginx/sites-available/crisiscleanup /etc/nginx/sites-enabled/crisiscleanup ln -s /etc/nginx/sites-available/crisiscleanup /etc/nginx/sites-enabled/crisiscleanup
# Restart services # Restart services

12
cts.sh
View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/cts
# Install packages # Install packages
apt-get -y --no-install-recommends install build-essential libpq-dev python-dev python-virtualenv virtualenv zlib1g-dev apt-get -y --no-install-recommends install build-essential libpq-dev python-dev python-virtualenv virtualenv zlib1g-dev
@ -14,13 +14,13 @@ virtualenv --no-site-packages --python=/usr/bin/python2.7 /srv/cts
# Create database # Create database
export CTS_PWD=$(head -c 18 /dev/urandom | base64) export CTS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/cts/tmp/cts-createdb.sql >/tmp/cts-createdb.sql envsubst <${SOURCE_DIR}/tmp/cts-createdb.sql >/tmp/cts-createdb.sql
sudo -u postgres psql -f /tmp/cts-createdb.sql sudo -u postgres psql -f /tmp/cts-createdb.sql
rm -f /tmp/cts-createdb.sql rm -f /tmp/cts-createdb.sql
# Configure CTS # Configure CTS
export CTS_SECRET=$(head -c 26 /dev/urandom | base64) export CTS_SECRET=$(head -c 26 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/cts/srv/cts/cts/settings/spotter.py >/srv/cts/cts/settings/spotter.py envsubst <${SOURCE_DIR}/srv/cts/cts/settings/spotter.py >/srv/cts/cts/settings/spotter.py
ln -s /srv/cts/lib/python2.7/site-packages/django/contrib/admin/static/admin /srv/cts/cts/static/admin ln -s /srv/cts/lib/python2.7/site-packages/django/contrib/admin/static/admin /srv/cts/cts/static/admin
ln -s /srv/cts/lib/python2.7/site-packages/django_extensions/static/django_extensions /srv/cts/cts/static/django_extensions ln -s /srv/cts/lib/python2.7/site-packages/django_extensions/static/django_extensions /srv/cts/cts/static/django_extensions
ln -s /srv/cts/lib/python2.7/site-packages/django_tables2/static/django_tables2 /srv/cts/cts/static/django_tables2 ln -s /srv/cts/lib/python2.7/site-packages/django_tables2/static/django_tables2 /srv/cts/cts/static/django_tables2
@ -43,7 +43,7 @@ export CTS_ADMIN_EMAIL=admin@example.com
export CTS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CTS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export CTS_ADMIN_HASH=$(cd /srv/cts && DJANGO_SETTINGS_MODULE=cts.settings.spotter /srv/cts/bin/python -c "from django.contrib.auth.hashers import make_password; print make_password('${CTS_ADMIN_PWD}')") export CTS_ADMIN_HASH=$(cd /srv/cts && DJANGO_SETTINGS_MODULE=cts.settings.spotter /srv/cts/bin/python -c "from django.contrib.auth.hashers import make_password; print make_password('${CTS_ADMIN_PWD}')")
export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13) export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13)
envsubst <${SOURCE_DIR}/cts/tmp/cts-adminpwd.sql >/tmp/cts-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/cts-adminpwd.sql >/tmp/cts-adminpwd.sql
sudo -u postgres psql -f /tmp/cts-adminpwd.sql cts sudo -u postgres psql -f /tmp/cts-adminpwd.sql cts
rm -f /tmp/cts-adminpwd.sql rm -f /tmp/cts-adminpwd.sql
@ -52,9 +52,9 @@ adduser --system --group --home /srv/cts --shell /bin/false cts
chown -R cts:cts /srv/cts chown -R cts:cts /srv/cts
# Create uwsgi and nginx app definition # Create uwsgi and nginx app definition
cp ${SOURCE_DIR}/cts/etc/uwsgi/apps-available/cts.ini /etc/uwsgi/apps-available/cts.ini cp ${SOURCE_DIR}/etc/uwsgi/apps-available/cts.ini /etc/uwsgi/apps-available/cts.ini
ln -s /etc/uwsgi/apps-available/cts.ini /etc/uwsgi/apps-enabled/cts.ini ln -s /etc/uwsgi/apps-available/cts.ini /etc/uwsgi/apps-enabled/cts.ini
cp ${SOURCE_DIR}/cts/etc/nginx/sites-available/cts /etc/nginx/sites-available/cts cp ${SOURCE_DIR}/etc/nginx/sites-available/cts /etc/nginx/sites-available/cts
ln -s /etc/nginx/sites-available/cts /etc/nginx/sites-enabled/cts ln -s /etc/nginx/sites-available/cts /etc/nginx/sites-enabled/cts
# Restart services # Restart services

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/gnuhealth
# Install dependencies for GNU Health # Install dependencies for GNU Health
apt-get -y --no-install-recommends install python3 python3-virtualenv virtualenv apt-get -y --no-install-recommends install python3 python3-virtualenv virtualenv
@ -23,7 +23,7 @@ rm -f /tmp/gnuhealth.tgz
git clone -b 4.2 --single-branch --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao git clone -b 4.2 --single-branch --depth 1 https://github.com/tryton/sao /srv/gnuhealth/sao
# Apply Sao (Tryton web client) dependencies patch # Apply Sao (Tryton web client) dependencies patch
patch -d /srv/gnuhealth/sao -p0 <${SOURCE_DIR}/gnuhealth/gnuhealth-sao-dependencies.patch patch -d /srv/gnuhealth/sao -p0 <${SOURCE_DIR}/gnuhealth-sao-dependencies.patch
# Create Python virtualenv # Create Python virtualenv
virtualenv --system-site-packages -p /usr/bin/python3 /srv/gnuhealth virtualenv --system-site-packages -p /usr/bin/python3 /srv/gnuhealth
@ -31,7 +31,7 @@ echo '. /srv/gnuhealth/bin/activate' >/srv/gnuhealth/.bash_profile
# Create databases # Create databases
export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=') export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=')
envsubst <${SOURCE_DIR}/gnuhealth/tmp/gnuhealth-createdb.sql >/tmp/gnuhealth-createdb.sql envsubst <${SOURCE_DIR}/tmp/gnuhealth-createdb.sql >/tmp/gnuhealth-createdb.sql
sudo -u postgres psql -f /tmp/gnuhealth-createdb.sql sudo -u postgres psql -f /tmp/gnuhealth-createdb.sql
rm -f /tmp/gnuhealth-createdb.sql rm -f /tmp/gnuhealth-createdb.sql
@ -47,7 +47,7 @@ sudo -u gnuhealth npm install --production --prefix /srv/gnuhealth/sao
sudo -u gnuhealth bash -c 'cd /srv/gnuhealth/sao && /srv/gnuhealth/sao/node_modules/grunt-cli/bin/grunt' sudo -u gnuhealth bash -c 'cd /srv/gnuhealth/sao && /srv/gnuhealth/sao/node_modules/grunt-cli/bin/grunt'
# Configure GNU Health # Configure GNU Health
envsubst <${SOURCE_DIR}/gnuhealth/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf >/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf envsubst <${SOURCE_DIR}/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf >/srv/gnuhealth/gnuhealth/tryton/server/config/trytond.conf
# Populate database # Populate database
export GNUHEALTH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export GNUHEALTH_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
@ -63,13 +63,13 @@ unset PGPASSWORD
rm -f /tmp/gnuhealth_demo.sql.gz rm -f /tmp/gnuhealth_demo.sql.gz
# Configure GNU Health service # Configure GNU Health service
cp ${SOURCE_DIR}/gnuhealth/lib/systemd/system/gnuhealth.service /lib/systemd/system/gnuhealth.service cp ${SOURCE_DIR}/lib/systemd/system/gnuhealth.service /lib/systemd/system/gnuhealth.service
systemctl daemon-reload systemctl daemon-reload
systemctl enable gnuhealth systemctl enable gnuhealth
systemctl start gnuhealth systemctl start gnuhealth
# Create nginx site definition # Create nginx site definition
cp ${SOURCE_DIR}/gnuhealth/etc/nginx/sites-available/gnuhealth /etc/nginx/sites-available/gnuhealth cp ${SOURCE_DIR}/etc/nginx/sites-available/gnuhealth /etc/nginx/sites-available/gnuhealth
ln -s /etc/nginx/sites-available/gnuhealth /etc/nginx/sites-enabled/gnuhealth ln -s /etc/nginx/sites-available/gnuhealth /etc/nginx/sites-enabled/gnuhealth
# Restart nginx # Restart nginx

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/kanboard
# Install dependencies for Kanboard # Install dependencies for Kanboard
apt-get -y --no-install-recommends install php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-zip apt-get -y --no-install-recommends install php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-zip
@ -28,7 +28,7 @@ git clone --depth=1 https://github.com/xavividal/kanboard-plugin-relationgraph /
# Populate database # Populate database
export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64) export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/kanboard/tmp/kanboard-createdb.sql >/tmp/kanboard-createdb.sql envsubst <${SOURCE_DIR}/tmp/kanboard-createdb.sql >/tmp/kanboard-createdb.sql
sudo -u postgres psql -f /tmp/kanboard-createdb.sql sudo -u postgres psql -f /tmp/kanboard-createdb.sql
rm -f /tmp/kanboard-createdb.sql rm -f /tmp/kanboard-createdb.sql
export PGPASSWORD=${KANBOARD_PWD} export PGPASSWORD=${KANBOARD_PWD}
@ -36,11 +36,11 @@ psql -f /srv/kanboard/app/Schema/Sql/postgres.sql kanboard kanboard
unset PGPASSWORD unset PGPASSWORD
# Configure Kanboard # Configure Kanboard
envsubst <${SOURCE_DIR}/kanboard/srv/kanboard/config.php >/srv/kanboard/config.php envsubst <${SOURCE_DIR}/srv/kanboard/config.php >/srv/kanboard/config.php
export KANBOARD_ADMIN_USER=admin export KANBOARD_ADMIN_USER=admin
export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export KANBOARD_ADMIN_HASH=$(php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);") export KANBOARD_ADMIN_HASH=$(php -r "echo password_hash('${KANBOARD_ADMIN_PWD}', PASSWORD_BCRYPT);")
envsubst <${SOURCE_DIR}/kanboard/tmp/kanboard-adminpwd.sql >/tmp/kanboard-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/kanboard-adminpwd.sql >/tmp/kanboard-adminpwd.sql
sudo -u postgres psql -f /tmp/kanboard-adminpwd.sql kanboard sudo -u postgres psql -f /tmp/kanboard-adminpwd.sql kanboard
# Create OS user # Create OS user
@ -48,8 +48,8 @@ adduser --system --group --home /srv/kanboard --shell /bin/false kanboard
chown -R kanboard:www-data /srv/kanboard/ chown -R kanboard:www-data /srv/kanboard/
# Create PHP and nginx app definition # Create PHP and nginx app definition
cp ${SOURCE_DIR}/kanboard/etc/php/7.0/fpm/pool.d/kanboard.conf /etc/php/7.0/fpm/pool.d/kanboard.conf cp ${SOURCE_DIR}/etc/php/7.0/fpm/pool.d/kanboard.conf /etc/php/7.0/fpm/pool.d/kanboard.conf
cp ${SOURCE_DIR}/kanboard/etc/nginx/apps-available/kanboard /etc/nginx/apps-available/kanboard cp ${SOURCE_DIR}/etc/nginx/apps-available/kanboard /etc/nginx/apps-available/kanboard
ln -s /etc/nginx/apps-available/kanboard /etc/nginx/apps-enabled/kanboard ln -s /etc/nginx/apps-available/kanboard /etc/nginx/apps-enabled/kanboard
# Restart services # Restart services
@ -57,7 +57,7 @@ systemctl restart php7.0-fpm
systemctl restart nginx systemctl restart nginx
# Install cron job # Install cron job
cp ${SOURCE_DIR}/kanboard/etc/cron.d/kanboard /etc/cron.d/kanboard cp ${SOURCE_DIR}/etc/cron.d/kanboard /etc/cron.d/kanboard
# Add portal application definition # Add portal application definition
portal-app-manager kanboard "/kanboard/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}" portal-app-manager kanboard "/kanboard/" "${KANBOARD_ADMIN_USER}" "${KANBOARD_ADMIN_PWD}"

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/pandora
# Add Pandora repository # Add Pandora repository
echo "deb http://ppa.launchpad.net/j/pandora/ubuntu zesty main" > /etc/apt/sources.list.d/pandora.list echo "deb http://ppa.launchpad.net/j/pandora/ubuntu zesty main" > /etc/apt/sources.list.d/pandora.list
apt-key add ${SOURCE_DIR}/pandora/pandora.gpg apt-key add ${SOURCE_DIR}/pandora.gpg
apt-get -y update apt-get -y update
# Install packages # Install packages
@ -16,11 +16,11 @@ git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs
git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines
# Copy Czech translataion # Copy Czech translataion
cp ${SOURCE_DIR}/pandora/srv/pandora/static/json/locale.0xdb.cs.json /srv/pandora/static/json/locale.0xdb.cs.json cp ${SOURCE_DIR}/srv/pandora/static/json/locale.0xdb.cs.json /srv/pandora/static/json/locale.0xdb.cs.json
cp ${SOURCE_DIR}/pandora/srv/pandora/static/json/locale.pandora.cs.json /srv/pandora/static/json/locale.pandora.cs.json cp ${SOURCE_DIR}/srv/pandora/static/json/locale.pandora.cs.json /srv/pandora/static/json/locale.pandora.cs.json
cp ${SOURCE_DIR}/pandora/srv/pandora/static/oxjs/source/Ox/js/Constants.js /srv/pandora/static/oxjs/source/Ox/js/Constants.js cp ${SOURCE_DIR}/srv/pandora/static/oxjs/source/Ox/js/Constants.js /srv/pandora/static/oxjs/source/Ox/js/Constants.js
cp ${SOURCE_DIR}/pandora/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json /srv/pandora/static/oxjs/source/Ox/json/locale.cs.json cp ${SOURCE_DIR}/srv/pandora/static/oxjs/source/Ox/json/locale.cs.json /srv/pandora/static/oxjs/source/Ox/json/locale.cs.json
cp ${SOURCE_DIR}/pandora/srv/pandora/static/oxjs/source/UI/json/locale.cs.json /srv/pandora/static/oxjs/source/UI/json/locale.cs.json cp ${SOURCE_DIR}/srv/pandora/static/oxjs/source/UI/json/locale.cs.json /srv/pandora/static/oxjs/source/UI/json/locale.cs.json
# Create Python virtualenv # Create Python virtualenv
virtualenv --system-site-packages -p /usr/bin/python3 /srv/pandora virtualenv --system-site-packages -p /usr/bin/python3 /srv/pandora
@ -29,7 +29,7 @@ virtualenv --system-site-packages -p /usr/bin/python3 /srv/pandora
# Create PostgreSQL user and database # Create PostgreSQL user and database
export PANDORA_PWD=$(head -c 18 /dev/urandom | base64) export PANDORA_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/pandora/tmp/pandora-createdb.sql >/tmp/pandora-createdb.sql envsubst <${SOURCE_DIR}/tmp/pandora-createdb.sql >/tmp/pandora-createdb.sql
sudo -u postgres psql -f /tmp/pandora-createdb.sql sudo -u postgres psql -f /tmp/pandora-createdb.sql
rm -f /tmp/pandora-createdb.sql rm -f /tmp/pandora-createdb.sql
@ -42,9 +42,9 @@ rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*"
# Configure Pandora # Configure Pandora
mkdir /srv/pandora/data mkdir /srv/pandora/data
cp ${SOURCE_DIR}/pandora/srv/pandora/pandora/config.jsonc /srv/pandora/pandora/config.jsonc cp ${SOURCE_DIR}/srv/pandora/pandora/config.jsonc /srv/pandora/pandora/config.jsonc
cp /srv/pandora/pandora/gunicorn_config.py.in /srv/pandora/pandora/gunicorn_config.py cp /srv/pandora/pandora/gunicorn_config.py.in /srv/pandora/pandora/gunicorn_config.py
envsubst <${SOURCE_DIR}/pandora/srv/pandora/pandora/local_settings.py >/srv/pandora/pandora/local_settings.py envsubst <${SOURCE_DIR}/srv/pandora/pandora/local_settings.py >/srv/pandora/pandora/local_settings.py
# Set "production values" (increases performance) only if the DEBUG environment variable is not set # Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then if [ ${DEBUG:-0} -eq 0 ]; then
@ -63,12 +63,12 @@ export PANDORA_ADMIN_USER=admin
export PANDORA_ADMIN_EMAIL=admin@example.com export PANDORA_ADMIN_EMAIL=admin@example.com
export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export PANDORA_ADMIN_HASH=$(cd /srv/pandora && DJANGO_SETTINGS_MODULE=pandora.settings /srv/pandora/bin/python -c "from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))") export PANDORA_ADMIN_HASH=$(cd /srv/pandora && DJANGO_SETTINGS_MODULE=pandora.settings /srv/pandora/bin/python -c "from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))")
envsubst <${SOURCE_DIR}/pandora/tmp/pandora-adminpwd.sql >/tmp/pandora-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/pandora-adminpwd.sql >/tmp/pandora-adminpwd.sql
sudo -u postgres psql -f /tmp/pandora-adminpwd.sql pandora sudo -u postgres psql -f /tmp/pandora-adminpwd.sql pandora
rm -f /tmp/pandora-adminpwd.sql rm -f /tmp/pandora-adminpwd.sql
# Create nginx site definition # Create nginx site definition
cp ${SOURCE_DIR}/pandora/etc/nginx/sites-available/pandora /etc/nginx/sites-available/pandora cp ${SOURCE_DIR}/etc/nginx/sites-available/pandora /etc/nginx/sites-available/pandora
ln -s /etc/nginx/sites-available/pandora /etc/nginx/sites-enabled/pandora ln -s /etc/nginx/sites-available/pandora /etc/nginx/sites-enabled/pandora
# Install and start services # Install and start services

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/sahana
# Install dependencies for Sahana # Install dependencies for Sahana
apt-get -y --no-install-recommends install python-dateutil python-imaging python-lxml python-matplotlib python-openid python-psycopg2 python-pyth python-reportlab python-requests python-shapely python-tweepy python-xlrd python-xlwt apt-get -y --no-install-recommends install python-dateutil python-imaging python-lxml python-matplotlib python-openid python-psycopg2 python-pyth python-reportlab python-requests python-shapely python-tweepy python-xlrd python-xlwt
@ -21,7 +21,7 @@ cd -
rm -rf /tmp/TwitterSearch rm -rf /tmp/TwitterSearch
# Copy Czech language file # Copy Czech language file
cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/languages/cs.py /srv/sahana/applications/eden/languages/cs.py cp ${SOURCE_DIR}/srv/sahana/applications/eden/languages/cs.py /srv/sahana/applications/eden/languages/cs.py
# Symlink fonts with Czech glyphs # Symlink fonts with Czech glyphs
ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sahana/applications/eden/static/fonts/DejaVuSerif-Bold.ttf ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sahana/applications/eden/static/fonts/DejaVuSerif-Bold.ttf
@ -29,14 +29,14 @@ ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf /srv/sahana/applications/
# Create PostgreSQL user and database # Create PostgreSQL user and database
export SAHANA_PWD=$(head -c 18 /dev/urandom | base64) export SAHANA_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/sahana/tmp/sahana-createdb.sql >/tmp/sahana-createdb.sql envsubst <${SOURCE_DIR}/tmp/sahana-createdb.sql >/tmp/sahana-createdb.sql
sudo -u postgres psql -f /tmp/sahana-createdb.sql sudo -u postgres psql -f /tmp/sahana-createdb.sql
rm -f /tmp/sahana-createdb.sql rm -f /tmp/sahana-createdb.sql
# Configure web2py # Configure web2py
rm -rf /srv/sahana/applications/{admin,examples,welcome} rm -rf /srv/sahana/applications/{admin,examples,welcome}
cp ${SOURCE_DIR}/sahana/srv/sahana/routes.py /srv/sahana/routes.py cp ${SOURCE_DIR}/srv/sahana/routes.py /srv/sahana/routes.py
cp ${SOURCE_DIR}/sahana/srv/sahana/run_scheduler.py /srv/sahana/run_scheduler.py cp ${SOURCE_DIR}/srv/sahana/run_scheduler.py /srv/sahana/run_scheduler.py
ln -s /srv/sahana/handlers/wsgihandler.py /srv/sahana/wsgihandler.py ln -s /srv/sahana/handlers/wsgihandler.py /srv/sahana/wsgihandler.py
# Configure Sahana # Configure Sahana
@ -44,12 +44,12 @@ mkdir /srv/sahana/applications/eden/{databases,errors,sessions}
mkdir -p /srv/sahana/applications/eden/static/cache/chart mkdir -p /srv/sahana/applications/eden/static/cache/chart
mkdir -p /srv/sahana/applications/eden/uploads/{gis_cache,images,tracks} mkdir -p /srv/sahana/applications/eden/uploads/{gis_cache,images,tracks}
export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64) export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/sahana/srv/sahana/applications/eden/models/000_config.py >/srv/sahana/applications/eden/models/000_config.py envsubst <${SOURCE_DIR}/srv/sahana/applications/eden/models/000_config.py >/srv/sahana/applications/eden/models/000_config.py
cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/models/00_settings.py /srv/sahana/applications/eden/models/00_settings.py cp ${SOURCE_DIR}/srv/sahana/applications/eden/models/00_settings.py /srv/sahana/applications/eden/models/00_settings.py
export SAHANA_ADMIN_USER=admin@example.com export SAHANA_ADMIN_USER=admin@example.com
export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
cp -r ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/modules/templates/Spotter /srv/sahana/applications/eden/modules/templates/ cp -r ${SOURCE_DIR}/srv/sahana/applications/eden/modules/templates/Spotter /srv/sahana/applications/eden/modules/templates/
envsubst <${SOURCE_DIR}/sahana/srv/sahana/applications/eden/modules/templates/Spotter/masterUsers.csv >/srv/sahana/applications/eden/modules/templates/Spotter/masterUsers.csv envsubst <${SOURCE_DIR}/srv/sahana/applications/eden/modules/templates/Spotter/masterUsers.csv >/srv/sahana/applications/eden/modules/templates/Spotter/masterUsers.csv
# Create OS user # Create OS user
adduser --system --group --home /srv/sahana --shell /bin/false sahana adduser --system --group --home /srv/sahana --shell /bin/false sahana
@ -68,9 +68,9 @@ if [ ${DEBUG:-0} -eq 0 ]; then
fi fi
# Create uwsgi and nginx app definition # Create uwsgi and nginx app definition
cp ${SOURCE_DIR}/sahana/etc/uwsgi/apps-available/sahana.ini /etc/uwsgi/apps-available/sahana.ini cp ${SOURCE_DIR}/etc/uwsgi/apps-available/sahana.ini /etc/uwsgi/apps-available/sahana.ini
ln -s /etc/uwsgi/apps-available/sahana.ini /etc/uwsgi/apps-enabled/sahana.ini ln -s /etc/uwsgi/apps-available/sahana.ini /etc/uwsgi/apps-enabled/sahana.ini
cp ${SOURCE_DIR}/sahana/etc/nginx/apps-available/sahana /etc/nginx/apps-available/sahana cp ${SOURCE_DIR}/etc/nginx/apps-available/sahana /etc/nginx/apps-available/sahana
ln -s /etc/nginx/apps-available/sahana /etc/nginx/apps-enabled/sahana ln -s /etc/nginx/apps-available/sahana /etc/nginx/apps-enabled/sahana
# Restart services # Restart services

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/sambro
# Install dependencies for Sahana # Install dependencies for Sahana
apt-get -y --no-install-recommends install python-dateutil python-imaging python-lxml python-matplotlib python-openid python-psycopg2 python-pyth python-reportlab python-requests python-shapely python-tweepy python-xlrd python-xlwt apt-get -y --no-install-recommends install python-dateutil python-imaging python-lxml python-matplotlib python-openid python-psycopg2 python-pyth python-reportlab python-requests python-shapely python-tweepy python-xlrd python-xlwt
@ -21,7 +21,7 @@ cd -
rm -rf /tmp/TwitterSearch rm -rf /tmp/TwitterSearch
# Copy Czech language file # Copy Czech language file
cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/languages/cs.py /srv/sambro/applications/eden/languages/cs.py cp ${SOURCE_DIR}/srv/sambro/applications/eden/languages/cs.py /srv/sambro/applications/eden/languages/cs.py
# Symlink fonts with Czech glyphs # Symlink fonts with Czech glyphs
ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sambro/applications/eden/static/fonts/DejaVuSerif-Bold.ttf ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf /srv/sambro/applications/eden/static/fonts/DejaVuSerif-Bold.ttf
@ -29,14 +29,14 @@ ln -s /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf /srv/sambro/applications/
# Create PostgreSQL user and database # Create PostgreSQL user and database
export SAMBRO_PWD=$(head -c 18 /dev/urandom | base64) export SAMBRO_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/sambro/tmp/sambro-createdb.sql >/tmp/sambro-createdb.sql envsubst <${SOURCE_DIR}/tmp/sambro-createdb.sql >/tmp/sambro-createdb.sql
sudo -u postgres psql -f /tmp/sambro-createdb.sql sudo -u postgres psql -f /tmp/sambro-createdb.sql
rm -f /tmp/sambro-createdb.sql rm -f /tmp/sambro-createdb.sql
# Configure web2py # Configure web2py
rm -rf /srv/sambro/applications/{admin,examples,welcome} rm -rf /srv/sambro/applications/{admin,examples,welcome}
cp ${SOURCE_DIR}/sahana/srv/sahana/routes.py /srv/sambro/routes.py cp ${SOURCE_DIR}/srv/sambro/routes.py /srv/sambro/routes.py
cp ${SOURCE_DIR}/sahana/srv/sahana/run_scheduler.py /srv/sambro/run_scheduler.py cp ${SOURCE_DIR}/srv/sambro/run_scheduler.py /srv/sambro/run_scheduler.py
ln -s /srv/sambro/handlers/wsgihandler.py /srv/sambro/wsgihandler.py ln -s /srv/sambro/handlers/wsgihandler.py /srv/sambro/wsgihandler.py
# Configure Sahana # Configure Sahana
@ -44,12 +44,12 @@ mkdir /srv/sambro/applications/eden/{databases,errors,sessions}
mkdir -p /srv/sambro/applications/eden/static/cache/chart mkdir -p /srv/sambro/applications/eden/static/cache/chart
mkdir -p /srv/sambro/applications/eden/uploads/{gis_cache,images,tracks} mkdir -p /srv/sambro/applications/eden/uploads/{gis_cache,images,tracks}
export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64) export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/sambro/srv/sambro/applications/eden/models/000_config.py >/srv/sambro/applications/eden/models/000_config.py envsubst <${SOURCE_DIR}/srv/sambro/applications/eden/models/000_config.py >/srv/sambro/applications/eden/models/000_config.py
cp ${SOURCE_DIR}/sahana/srv/sahana/applications/eden/models/00_settings.py /srv/sambro/applications/eden/models/00_settings.py cp ${SOURCE_DIR}/srv/sambro/applications/eden/models/00_settings.py /srv/sambro/applications/eden/models/00_settings.py
export SAMBRO_ADMIN_USER=admin@example.com export SAMBRO_ADMIN_USER=admin@example.com
export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SAMBRO_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
cp ${SOURCE_DIR}/sambro/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py /srv/sambro/applications/eden/modules/templates/SAMBRO/config.py cp ${SOURCE_DIR}/srv/sambro/applications/eden/modules/templates/SAMBRO/config.py /srv/sambro/applications/eden/modules/templates/SAMBRO/config.py
envsubst <${SOURCE_DIR}/sambro/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv >/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv envsubst <${SOURCE_DIR}/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv >/srv/sambro/applications/eden/modules/templates/default/users/masterUsers.csv
# Create OS user # Create OS user
adduser --system --group --home /srv/sambro --shell /bin/false sambro adduser --system --group --home /srv/sambro --shell /bin/false sambro
@ -68,9 +68,9 @@ if [ ${DEBUG:-0} -eq 0 ]; then
fi fi
# Create uwsgi and nginx app definition # Create uwsgi and nginx app definition
cp ${SOURCE_DIR}/sambro/etc/uwsgi/apps-available/sambro.ini /etc/uwsgi/apps-available/sambro.ini cp ${SOURCE_DIR}/etc/uwsgi/apps-available/sambro.ini /etc/uwsgi/apps-available/sambro.ini
ln -s /etc/uwsgi/apps-available/sambro.ini /etc/uwsgi/apps-enabled/sambro.ini ln -s /etc/uwsgi/apps-available/sambro.ini /etc/uwsgi/apps-enabled/sambro.ini
cp ${SOURCE_DIR}/sambro/etc/nginx/sites-available/sambro /etc/nginx/sites-available/sambro cp ${SOURCE_DIR}/etc/nginx/sites-available/sambro /etc/nginx/sites-available/sambro
ln -s /etc/nginx/sites-available/sambro /etc/nginx/sites-enabled/sambro ln -s /etc/nginx/sites-available/sambro /etc/nginx/sites-enabled/sambro
# Restart services # Restart services

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,313 @@
# -*- coding: utf-8 -*-
"""
Global settings:
Those which are typically edited during a deployment are in
000_config.py & their results parsed into here. Deployers
shouldn't typically need to edit any settings here.
"""
# Keep all our configuration options off the main global variables
# Use response.s3 for one-off variables which are visible in views without explicit passing
s3.formats = Storage()
# Workaround for this Bug in Selenium with FF4:
# http://code.google.com/p/selenium/issues/detail?id=1604
s3.interactive = settings.get_ui_confirm()
s3.base_url = "%s/%s" % (settings.get_base_public_url(),
appname)
s3.download_url = "%s/default/download" % s3.base_url
# -----------------------------------------------------------------------------
# Client tests
# Check whether browser is Mobile & store result in session
# - commented-out until we make use of it
#if session.s3.mobile is None:
# session.s3.mobile = s3base.s3_is_mobile_client(request)
#if session.s3.browser is None:
# session.s3.browser = s3base.s3_populate_browser_compatibility(request)
# -----------------------------------------------------------------------------
# Global variables
# Strings to i18n
# Common Labels
#messages["BREADCRUMB"] = ">> "
messages["UNKNOWN_OPT"] = ""
messages["NONE"] = ""
messages["READ"] = settings.get_ui_label_read()
messages["UPDATE"] = settings.get_ui_label_update()
messages["DELETE"] = "Delete"
messages["COPY"] = "Copy"
messages["NOT_APPLICABLE"] = "N/A"
messages["ADD_PERSON"] = "Create a Person"
messages["ADD_LOCATION"] = "Create Location"
messages["SELECT_LOCATION"] = "Select a location"
messages["COUNTRY"] = "Country"
messages["ORGANISATION"] = "Organization"
messages["AUTOCOMPLETE_HELP"] = "Enter some characters to bring up a list of possible matches"
for u in messages:
if isinstance(messages[u], str):
globals()[u] = T(messages[u])
# CRUD Labels
s3.crud_labels = Storage(READ=READ,
UPDATE=UPDATE,
DELETE=DELETE,
COPY=COPY,
NONE=NONE,
)
# Error Messages
ERROR["BAD_RECORD"] = "Record not found!"
ERROR["BAD_METHOD"] = "Unsupported method!"
ERROR["BAD_FORMAT"] = "Unsupported data format!"
ERROR["BAD_REQUEST"] = "Invalid request"
ERROR["BAD_SOURCE"] = "Invalid source"
ERROR["BAD_TEMPLATE"] = "XSLT stylesheet not found"
ERROR["BAD_RESOURCE"] = "Nonexistent or invalid resource"
ERROR["DATA_IMPORT_ERROR"] = "Data import error"
ERROR["INTEGRITY_ERROR"] = "Integrity error: record can not be deleted while it is referenced by other records"
ERROR["METHOD_DISABLED"] = "Method disabled"
ERROR["NO_MATCH"] = "No matching element found in the data source"
ERROR["NOT_IMPLEMENTED"] = "Not implemented"
ERROR["NOT_PERMITTED"] = "Operation not permitted"
ERROR["PARSE_ERROR"] = "XML parse error"
ERROR["TRANSFORMATION_ERROR"] = "XSLT transformation error"
ERROR["UNAUTHORISED"] = "Not Authorized"
ERROR["VALIDATION_ERROR"] = "Validation error"
# To get included in <HEAD>
s3.stylesheets = []
s3.external_stylesheets = []
# To get included at the end of <BODY>
s3.scripts = []
s3.js_global = []
s3.jquery_ready = []
# -----------------------------------------------------------------------------
# Languages
s3.l10n_languages = settings.get_L10n_languages()
# Default strings are in US English
T.current_languages = ("en", "en-us")
# Check if user has selected a specific language
if get_vars._language:
language = get_vars._language
session.s3.language = language
elif session.s3.language:
# Use the last-selected language
language = session.s3.language
elif auth.is_logged_in():
# Use user preference
language = auth.user.language
else:
# Use system default
language = settings.get_L10n_default_language()
#else:
# # Use what browser requests (default web2py behaviour)
# T.force(T.http_accept_language)
# IE doesn't set request.env.http_accept_language
#if language != "en":
T.force(language)
# Store for views (e.g. Ext)
if language.find("-") == -1:
# Ext peculiarities
if language == "vi":
s3.language = "vn"
elif language == "el":
s3.language = "el_GR"
else:
s3.language = language
else:
lang_parts = language.split("-")
s3.language = "%s_%s" % (lang_parts[0], lang_parts[1].upper())
# List of Languages which use a Right-to-Left script (Arabic, Hebrew, Farsi, Urdu)
if language in ("ar", "prs", "ps", "ur"):
s3.rtl = True
else:
s3.rtl = False
# -----------------------------------------------------------------------------
# Auth
_settings = auth.settings
_settings.lock_keys = False
_settings.expiration = 28800 # seconds
if settings.get_auth_openid():
# Requires http://pypi.python.org/pypi/python-openid/
try:
from gluon.contrib.login_methods.openid_auth import OpenIDAuth
openid_login_form = OpenIDAuth(auth)
from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm
_settings.login_form = ExtendedLoginForm(auth, openid_login_form,
signals=["oid", "janrain_nonce"])
except ImportError:
session.warning = "Library support not available for OpenID"
# Allow use of LDAP accounts for login
# NB Currently this means that change password should be disabled:
#_settings.actions_disabled.append("change_password")
# (NB These are not automatically added to PR or to Authenticated role since they enter via the login() method not register())
#from gluon.contrib.login_methods.ldap_auth import ldap_auth
# Require even alternate login methods to register users 1st
#_settings.alternate_requires_registration = True
# Active Directory
#_settings.login_methods.append(ldap_auth(mode="ad", server="dc.domain.org", base_dn="ou=Users,dc=domain,dc=org"))
# or if not wanting local users at all (no passwords saved within DB):
#_settings.login_methods = [ldap_auth(mode="ad", server="dc.domain.org", base_dn="ou=Users,dc=domain,dc=org")]
# Domino
#_settings.login_methods.append(ldap_auth(mode="domino", server="domino.domain.org"))
# OpenLDAP
#_settings.login_methods.append(ldap_auth(server="directory.sahanafoundation.org", base_dn="ou=users,dc=sahanafoundation,dc=org"))
# Allow use of Email accounts for login
#_settings.login_methods.append(email_auth("smtp.gmail.com:587", "@gmail.com"))
# Require captcha verification for registration
#auth.settings.captcha = RECAPTCHA(request, public_key="PUBLIC_KEY", private_key="PRIVATE_KEY")
# Require Email Verification
_settings.registration_requires_verification = settings.get_auth_registration_requires_verification()
_settings.on_failed_authorization = URL(c="default", f="user",
args="not_authorized")
_settings.reset_password_requires_verification = True
_settings.verify_email_next = URL(c="default", f="index")
# Require Admin approval for self-registered users
_settings.registration_requires_approval = settings.get_auth_registration_requires_approval()
# We don't wish to clutter the groups list with 1 per user.
_settings.create_user_groups = False
# We need to allow basic logins for Webservices
_settings.allow_basic_login = True
_settings.logout_onlogout = s3_auth_on_logout
_settings.login_onaccept = s3_auth_on_login
_settings.login_next = settings.get_auth_login_next()
if settings.has_module("vol") and \
settings.get_auth_registration_volunteer():
_settings.register_next = URL(c="vol", f="person")
# Languages available in User Profiles
if len(s3.l10n_languages) > 1:
_settings.table_user.language.requires = IS_IN_SET(s3.l10n_languages,
zero=None)
else:
field = _settings.table_user.language
field.default = s3.l10n_languages.keys()[0]
field.readable = False
field.writable = False
_settings.lock_keys = True
# -----------------------------------------------------------------------------
# Mail
# These settings could be made configurable as part of the Messaging Module
# - however also need to be used by Auth (order issues)
sender = settings.get_mail_sender()
if sender:
mail.settings.sender = sender
mail.settings.server = settings.get_mail_server()
mail.settings.tls = settings.get_mail_server_tls()
mail_server_login = settings.get_mail_server_login()
if mail_server_login:
mail.settings.login = mail_server_login
# Email settings for registration verification and approval
_settings.mailer = mail
# -----------------------------------------------------------------------------
# Session
# Custom Notifications
response.error = session.error
response.confirmation = session.confirmation
response.information = session.information
response.warning = session.warning
session.error = []
session.confirmation = []
session.information = []
session.warning = []
# Shortcuts for system role IDs, see modules/s3aaa.py/AuthS3
system_roles = auth.get_system_roles()
ADMIN = system_roles.ADMIN
AUTHENTICATED = system_roles.AUTHENTICATED
ANONYMOUS = system_roles.ANONYMOUS
EDITOR = system_roles.EDITOR
MAP_ADMIN = system_roles.MAP_ADMIN
ORG_ADMIN = system_roles.ORG_ADMIN
ORG_GROUP_ADMIN = system_roles.ORG_GROUP_ADMIN
if s3.debug:
# Add the developer toolbar from modules/s3/s3utils.py
s3.toolbar = s3base.s3_dev_toolbar
# -----------------------------------------------------------------------------
# CRUD
s3_formstyle = settings.get_ui_formstyle()
s3_formstyle_read = settings.get_ui_formstyle_read()
s3_formstyle_mobile = s3_formstyle
submit_button = T("Save")
_crud = s3.crud
_crud.formstyle = s3_formstyle
_crud.formstyle_read = s3_formstyle_read
_crud.submit_button = submit_button
# Optional class for Submit buttons
#_crud.submit_style = "submit-button"
_crud.confirm_delete = T("Do you really want to delete these records?")
_crud.archive_not_delete = settings.get_security_archive_not_delete()
_crud.navigate_away_confirm = settings.get_ui_navigate_away_confirm()
# Content Type Headers, default is application/xml for XML formats
# and text/x-json for JSON formats, other content types must be
# specified here:
s3.content_type = Storage(
tc = "application/atom+xml", # TableCast feeds
rss = "application/rss+xml", # RSS
georss = "application/rss+xml", # GeoRSS
kml = "application/vnd.google-earth.kml+xml", # KML
)
# JSON Formats
s3.json_formats = ["geojson", "s3json"]
# CSV Formats
s3.csv_formats = ["hrf", "s3csv"]
# Datatables default number of rows per page
s3.ROWSPERPAGE = 20
# Valid Extensions for Image Upload fields
s3.IMAGE_EXTENSIONS = ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"]
# Default CRUD strings
s3.crud_strings = Storage(
label_create = T("Add Record"),
title_display = T("Record Details"),
title_list = T("Records"),
title_update = T("Edit Record"),
title_map = T("Map"),
title_report = T("Report"),
label_list_button = T("List Records"),
label_delete_button = T("Delete Record"),
msg_record_created = T("Record added"),
msg_record_modified = T("Record updated"),
msg_record_deleted = T("Record deleted"),
msg_list_empty = T("No Records currently available"),
msg_match = T("Matching Records"),
msg_no_match = T("No Matching Records"),
)
# END =========================================================================

View File

@ -0,0 +1,11 @@
#!/usr/bin/python
default_application = 'eden'
default_controller = 'default'
default_function = 'index'
routes_onerror = [
('eden/400', '!'),
('eden/401', '!'),
('eden/509', '!'),
('eden/*', '/eden/errors/index'),
('*/*', '/eden/errors/index'),
]

View File

@ -0,0 +1,6 @@
#!/usr/bin/env python
from gluon.shell import run
if __name__ == '__main__':
run('eden', True, True, None, False, 'from gluon import current; current._scheduler.loop()')

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/seeddms
# Install dependencies for SeedDMS # Install dependencies for SeedDMS
apt-get -y --no-install-recommends install ghostscript id3 imagemagick libreoffice-calc libreoffice-impress libreoffice-writer php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-xml php-pear poppler-utils unoconv apt-get -y --no-install-recommends install ghostscript id3 imagemagick libreoffice-calc libreoffice-impress libreoffice-writer php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-xml php-pear poppler-utils unoconv
@ -12,23 +12,23 @@ mv /srv/seeddms51x /srv/seeddms
rm -f /srv/seeddms.tgz rm -f /srv/seeddms.tgz
# Patch Previewers # Patch Previewers
patch -d /srv/seeddms -p0 <${SOURCE_DIR}/seeddms/seeddms-previewers.patch patch -d /srv/seeddms -p0 <${SOURCE_DIR}/seeddms-previewers.patch
# Populate database # Populate database
export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64) export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-createdb.sql >/tmp/seeddms-createdb.sql envsubst <${SOURCE_DIR}/tmp/seeddms-createdb.sql >/tmp/seeddms-createdb.sql
sudo -u postgres psql -f /tmp/seeddms-createdb.sql sudo -u postgres psql -f /tmp/seeddms-createdb.sql
rm -f /tmp/seeddms-createdb.sql rm -f /tmp/seeddms-createdb.sql
export PGPASSWORD=${SEEDDMS_PWD} export PGPASSWORD=${SEEDDMS_PWD}
psql -f /srv/seeddms/www/install/create_tables-postgres.sql seeddms seeddms psql -f /srv/seeddms/www/install/create_tables-postgres.sql seeddms seeddms
# Configure SeedDMS # Configure SeedDMS
envsubst <${SOURCE_DIR}/seeddms/srv/seeddms/www/conf/settings.xml >/srv/seeddms/www/conf/settings.xml envsubst <${SOURCE_DIR}/srv/seeddms/www/conf/settings.xml >/srv/seeddms/www/conf/settings.xml
rm -rf /srv/seeddms/www/install/ rm -rf /srv/seeddms/www/install/
export SEEDDMS_ADMIN_USER=admin export SEEDDMS_ADMIN_USER=admin
export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export SEEDDMS_ADMIN_EMAIL=admin@example.com export SEEDDMS_ADMIN_EMAIL=admin@example.com
envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-adminpwd.sql >/tmp/seeddms-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/seeddms-adminpwd.sql >/tmp/seeddms-adminpwd.sql
psql -f /tmp/seeddms-adminpwd.sql seeddms seeddms psql -f /tmp/seeddms-adminpwd.sql seeddms seeddms
unset PGPASSWORD unset PGPASSWORD
rm -f /tmp/seeddms-adminpwd.sql rm -f /tmp/seeddms-adminpwd.sql
@ -38,8 +38,8 @@ adduser --system --group --home /srv/seeddms --shell /bin/false seeddms
chown -R seeddms:www-data /srv/seeddms/ chown -R seeddms:www-data /srv/seeddms/
# Create PHP and nginx app definition # Create PHP and nginx app definition
cp ${SOURCE_DIR}/seeddms/etc/php/7.0/fpm/pool.d/seeddms.conf /etc/php/7.0/fpm/pool.d/seeddms.conf cp ${SOURCE_DIR}/etc/php/7.0/fpm/pool.d/seeddms.conf /etc/php/7.0/fpm/pool.d/seeddms.conf
cp ${SOURCE_DIR}/seeddms/etc/nginx/apps-available/seeddms /etc/nginx/apps-available/seeddms cp ${SOURCE_DIR}/etc/nginx/apps-available/seeddms /etc/nginx/apps-available/seeddms
ln -s /etc/nginx/apps-available/seeddms /etc/nginx/apps-enabled/seeddms ln -s /etc/nginx/apps-available/seeddms /etc/nginx/apps-enabled/seeddms
# Restart services # Restart services
@ -47,7 +47,7 @@ systemctl restart php7.0-fpm
systemctl restart nginx systemctl restart nginx
# Install cron job # Install cron job
cp ${SOURCE_DIR}/seeddms/etc/cron.d/seeddms /etc/cron.d/seeddms cp ${SOURCE_DIR}/etc/cron.d/seeddms /etc/cron.d/seeddms
# Add portal application definition # Add portal application definition
portal-app-manager seeddms "/seeddms/" "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}" portal-app-manager seeddms "/seeddms/" "${SEEDDMS_ADMIN_USER}" "${SEEDDMS_ADMIN_PWD}"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))/ushahidi
# Install dependencies for Ushahidi # Install dependencies for Ushahidi
apt-get -y --no-install-recommends install php7.0-curl php7.0-gd php7.0-fpm php7.0-json php7.0-imap php7.0-mcrypt php7.0-mysql apt-get -y --no-install-recommends install php7.0-curl php7.0-gd php7.0-fpm php7.0-json php7.0-imap php7.0-mcrypt php7.0-mysql
@ -14,11 +14,11 @@ rm -rf /tmp/ushahidi-platform-release-v3.7.1
# Create database # Create database
export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64) export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/ushahidi/tmp/ushahidi-createdb.sql >/tmp/ushahidi-createdb.sql envsubst <${SOURCE_DIR}/tmp/ushahidi-createdb.sql >/tmp/ushahidi-createdb.sql
mysql </tmp/ushahidi-createdb.sql mysql </tmp/ushahidi-createdb.sql
# Configure Ushahidi # Configure Ushahidi
envsubst <${SOURCE_DIR}/ushahidi/srv/ushahidi/platform/.env >/srv/ushahidi/platform/.env envsubst <${SOURCE_DIR}/srv/ushahidi/platform/.env >/srv/ushahidi/platform/.env
# Populate database # Populate database
cd /srv/ushahidi/platform cd /srv/ushahidi/platform
@ -28,7 +28,7 @@ cd /srv/ushahidi/platform
export USHAHIDI_ADMIN_USER=admin@example.com export USHAHIDI_ADMIN_USER=admin@example.com
export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
export USHAHIDI_ADMIN_HASH=$(php -r "echo password_hash('${USHAHIDI_ADMIN_PWD}', PASSWORD_BCRYPT);") export USHAHIDI_ADMIN_HASH=$(php -r "echo password_hash('${USHAHIDI_ADMIN_PWD}', PASSWORD_BCRYPT);")
envsubst <${SOURCE_DIR}/ushahidi/tmp/ushahidi-adminpwd.sql >/tmp/ushahidi-adminpwd.sql envsubst <${SOURCE_DIR}/tmp/ushahidi-adminpwd.sql >/tmp/ushahidi-adminpwd.sql
mysql ushahidi </tmp/ushahidi-adminpwd.sql mysql ushahidi </tmp/ushahidi-adminpwd.sql
rm -f /tmp/ushahidi-adminpwd.sql rm -f /tmp/ushahidi-adminpwd.sql
@ -37,8 +37,8 @@ adduser --system --group --home /srv/ushahidi --shell /bin/false ushahidi
chown -R ushahidi:www-data /srv/ushahidi/ chown -R ushahidi:www-data /srv/ushahidi/
# Create PHP and nginx app definition # Create PHP and nginx app definition
cp ${SOURCE_DIR}/ushahidi/etc/php/7.0/fpm/pool.d/ushahidi.conf /etc/php/7.0/fpm/pool.d/ushahidi.conf cp ${SOURCE_DIR}/etc/php/7.0/fpm/pool.d/ushahidi.conf /etc/php/7.0/fpm/pool.d/ushahidi.conf
cp ${SOURCE_DIR}/ushahidi/etc/nginx/sites-available/ushahidi /etc/nginx/sites-available/ushahidi cp ${SOURCE_DIR}/etc/nginx/sites-available/ushahidi /etc/nginx/sites-available/ushahidi
ln -s /etc/nginx/sites-available/ushahidi /etc/nginx/sites-enabled/ushahidi ln -s /etc/nginx/sites-available/ushahidi /etc/nginx/sites-enabled/ushahidi
# Restart services # Restart services
@ -46,7 +46,7 @@ systemctl restart php7.0-fpm
systemctl restart nginx systemctl restart nginx
# Install cron job # Install cron job
cp ${SOURCE_DIR}/ushahidi/etc/cron.d/ushahidi /etc/cron.d/ushahidi cp ${SOURCE_DIR}/etc/cron.d/ushahidi /etc/cron.d/ushahidi
# Add portal application definition # Add portal application definition
portal-app-manager ushahidi "https://{host}:8002/" "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" portal-app-manager ushahidi "https://{host}:8002/" "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}"