This repository mantains the code for deploying OsirisWebPlatform server on a linux machine (ubuntu 16.04), which means:
- Step 1: linux user creation
- Step 2: dependencies installation
- Step 3: postgresql configuration
- Step 4: creation of ssh keys
- Step 5: clone and setup of the django app
- Step 6: apache configuration
- Step 7: install CMM cluster code
This has been tested on Ubuntu 16.04 machines.
The installation script requires sudo access.
installServer.sh
script will use some commands with postgres user, so put installer folder under /root
path is not a good idea. We recommend to use /tmp
path.
Move to /tmp
directory
$ cd /tmp
Then type:
# clone directly on the target machine
$ git clone https://github.com/felipinbombin/osirisInstaller
You need following information:
<SERVER_PUBLIC_IP>
: This server public IP, used in apache configuration file<DATABASE_NAME>
: Name of the new database<POSGRES_USER>
: Name of the new postgres user<POSTGRES_USER_PASS>
: Postgres user's password<LINUX_USER_NAME>
: Linux user name used to choose the folder where web app project will be located (default:/home/<LINUX_USER_NAME>
)<DJANGO_SECRET_KEY>
: The django app needs a secret key, you can generate a new one here. It's very common that secret key contains some special character, so you need to put the code between double quote ('
).
It is highly recommended to read the script before running it and ALSO EXECUTTE IT BY ONE PIECE AT A TIME!. Modify the configuration section on installServer.sh
to select which steps you want to run. The recommended way is to deactivate all steps and run them separately.
Inside installServert.sh
you will discover 5 steps:
- Clone project: clone django server project
- Install packages: set virtualenv and install project dependencies
- Postgresql configuration: create database and database user
- Project configuration: Connect database with django project
- Apache configuration: set wsgi
you need two ssh keys to establish bidirectional channel between web platform and CMM cluster infrastructure. For this follow next steps:
- On osiris web server:
- Create a ssh key with command
ssh-keygen
(it is saved on~/.ssh/
folder) - Put private key (usually with name
id_rsa
) on file<SERVER_PATH>/osirisWebPlatform/keys/ssh_key
- Copy public key (usually with name
id_ras.pub
) on~/.ssh/authorized_keys
of CMM cluster
- Create a ssh key with command
- On CMM cluster (similar to prevoius step):
- Create a ssh key with command
ssh-keygen
(it is saved on~/.ssh/
folder) - Copy public key (usually with name
id_ras.pub
) on~/.ssh/authorized_keys
of osiris web server
- Create a ssh key with command
It is important to know that the name ssh key is not important so you can change it (for readbility for example).
You can check the connection status running tests
Bower manage javascript libraries used by visualization app but doesn't let you use it with sudo priviliges so it's probably you won't see a beatiful web page at the end of the process. To fix this problem you have to go <path_to_project>
and run bower install
with owner of directory where the project is.
Go to the installation folder and execute the next command line.
WARNING: PLEASE, do not call this script with like ./installServer.sh
.
# run with sudo
$ sudo bash installServer.sh <SERVER_PUBLIC_IP> <DATABASE_NAME> <POSTGRES_USER> <POSTGRES_USER_PASS> "<DJANGO_SECRET_KEY>"
When the script ends, you will need to append this machine IP address to ALLOWED_HOSTS
django variable on the settings.py
server file.
Finally, restart the apache server:
$ sudo service apache2 restart
To log in on web application you have to create a super user in django framework. You have to go <path_to_project>
and run the next command (createsuperuser).
$ python manage.py createsuperuser
With this new user you can create others through django admin web page (<SERVER_IP>/admin
).
crontab executes a periodical method that check if connection between osiris web server and cmm cluster had a problem and finish tasks that finished on cmm cluster without communicate this end to osiris web server. to activate you have to execute:
python manage.py crontab add
Crontab has other options as show
and remove
. More information here.
On CMM cluster you have to install this repository. It is very simple, just clone project:
git clone https://github.com/felipinbombin/OsirisWebPlatformCluster
The folders present in the cloned repository are:
- inputs: files generated by osiris web server based on user data
- logs: log files created by slurm (work load manager used by cmm cluster)
- models: osiris models
- outputs: model answers generated by models
- tmp: for temporal files, every file here can be deleted without pain or fear.
After run everything before you are ready to share the web site :-).