-
Notifications
You must be signed in to change notification settings - Fork 20
Setup Guide
The App Store requires the following software packages:
- Python 3.7
- Django 2.2.28
- Whoosh 2.7.4
- python-geoip (not sure if these is needed anymore)
- django-social-auth 0.7.28
- social-auth-app-django 3.1.0
- django-haystack 2.8.1
- sphinx
- urllib3
- Pillow
- gevent
- Database Server and appropriate client (AppStore uses Mysql)
NOTE: For exact requirements see requirements.txt
file in this repo. Once python 3.7 is setup pip install -r requirements.txt
will install all required packages
If you want to move the App Store to another machine running Ubuntu, here is what to do:
NOTE: These steps are derived from the bootstrap.sh
script, available in this repo, used to spin up Vagrant Virtual Machine with AppStore installed.
-
Install the following packages:
apt-get -y install apache2 apache2-dev apache2-utils ssl-cert wget apt-get -y install libapache2-mod-wsgi-py3 gcc g++ git apt-get -y install mysql-server apt-get -y install geoip-database # this may not be needed anymore
-
Install Miniconda (Anaconda could also be used with adjustments to paths below) to
/opt/miniconda3
and set PATH so that python calls use that Python.# as root pushd /tmp wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh chmod a+x Miniconda3-latest-Linux-x86_64.sh /bin/rm Miniconda3-latest-Linux-x86_64.sh popd # Set paths export PATH=/opt/miniconda3/bin:$PATH echo "export PATH=/opt/miniconda3/bin:$PATH" >> /root/.bash_profile echo "export PATH=/opt/miniconda3/bin:$PATH" >> /root/.bashrc
-
Install mysqlclient which is most easily done with
conda
:conda install -y mysqlclient
-
Install mod_wsgi:
pip install mod_wsgi
-
Configure mod_wsgi. These commands are derived from instructions found here:
# as root # update wsgi.conf configuration WSGI_CONF="/etc/apache2/mods-available/wsgi.conf" SITE_PKG=`find /opt/miniconda3 -regex "/opt/miniconda3/lib/python.*/site-packages$" -type d 2> /dev/null` echo "<IfModule mod_wsgi.c>" > $WSGI_CONF echo " WSGIPythonHome /opt/miniconda3" >> $WSGI_CONF echo " WSGIPythonPath $SITE_PKG" >> $WSGI_CONF echo "</IfModule>" >> $WSGI_CONF # update wsgi.load file mod_wsgi-express install-module | egrep "^LoadModule" > /etc/apache2/mods-available/wsgi.load # enable wsgi a2enmod wsgi # updates shared library cache (might not be needed anymore) ldconfig
-
Create database
# as root mysqladmin create AppStore
-
Create database user
# log into mysql with superuser account # as root mysql -u root # run these commands replacing @@PASSWORD@@ with a password that needs to be set in settings file later CREATE USER 'appstoreuser'@'localhost' IDENTIFIED BY '@@PASSWORD@@'; CREATE USER 'appstoreuser'@'127.0.0.1' IDENTIFIED BY '@@PASSWORD@@'; GRANT ALL PRIVILEGES ON AppStore.* to 'appstoreuser'@'localhost'; GRANT ALL PRIVILEGES ON AppStore.* to 'appstoreuser'@'127.0.0.1'; GRANT ALL PRIVILEGES ON test_AppStore.* to 'appstoreuser'@'localhost'; GRANT ALL PRIVILEGES ON test_AppStore.* to 'appstoreuser'@'127.0.0.1'; FLUSH PRIVILEGES;
-
Check out the App Store GitHub repository to the new machine under
/var/www
directory: http://github.com/cytoscape/appstore# as root pushd /var/www git clone http://github.com/cytoscape/appstore cd appstore # make some needed directories mkdir logs mkdir /var/www/html/media mkdir /var/www/html/misc cp favicon.ico /var/www/html/misc/. cp google_oauth2_logo.png /var/www/html/misc/.
-
Install needed Python modules:
# as root and in /var/www/appstore directory with /opt/miniconda/bin in PATH pip install -r requirements.txt
-
Create
settings/production.py
fromsettings/vagrant.py
and update the following:- Update values in
ADMINS
- Update
EMAIL_HOST, EMAIL_HOST_USER, EMAIL_ADDR, and EMAIL_HOST_PASSWORD
- Check
FULL_URL
is correct - Update
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY, SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET, & GOOGLE_API_KEY
- Comment out
EMAIL_BACKEND
line since we want to use regular SMTP - Set EMAIL CONFIGURATION
- Generate new
SECRET_KEY
and keep it secret. Click here for more information - Update database
@@PASSWORD@@
to match value set above
- Update values in
-
Create the following daily cron jobs on the new machine:
-
Database backups described above in the subsection Backup System.
-
As root run:
cd /var/www/appstore /opt/miniconda/bin/python manage.py rebuild_index` chown -R www-data.www-data /var/www/appstore/whoosh_index
-
-
Populate
/var/www/html/static
datacd /var/www/appstore /opt/miniconda3/bin/python manage.py collectstatic
-
Take a snapshot of the database using
mysqldump
then load it to the new machine's database:Run this on the old machine:
mysqldump -u USER_NAME DB_NAME > CyAppStoreDbDump.sql
Transfer CyAppStoreDbDump.sql from the old to new machine:
Run this on the new machine:
mysql -u USER_NAME DB_NAME < CyAppStoreDbDump.sql
-
Setup Lets Encrypt
-
Using
bootstrap.sh
as a guide copy overappstore.http.conf
andappstore.include.conf
-
Restart Apache and run the test protocol that's described below.
systemctl restart apache2