This is the repository for the Xtract Container Service (XCS), an application for pushing and pulling Docker and Singularity containers.
These instructions will get the XCS application running on your local machine for development and testing purposes.
- Docker (available here)
- Singularity (available here)
- AWS CLI (available here)
- AWS RDS, S3, SQS
- PostgreSQL
-
Clone this repository and activate a virtual environment:
git clone https://github.com/xtracthub/xtract-container-service cd xtract-container-service virtualenv venv source venv/bin/activate
-
Install the requirements:
pip install -r requirements.txt
-
Configure your AWS CLI:
aws configure
-
Next, create a PostgreSQL database in AWS RDS and store the following in a file named
database.ini
:[postgresql] host=YOUR_HOST_ADRESS database=postgres user=postgres password=YOUR_PASSWORD
-
Create an AWS S3 bucket and a SQS queue named
xtract-container-service
:
-
Save your Globus Auth. Client ID and Client Secret as environment variables:
export GL_CLIENT=YOUR_GL_CLIENT export GL_CLIENT_SECRET=YOUR_GL_CLIENT_SECRET
-
Save the path of the flask app. as an environment variable:
export FLASK_APP=application.py
-
Start the application with root privelages:
sudo flask run
-
Ensure the Docker daemon is running using
sudo dockerd
for Ubuntu or starting Docker Desktop for Mac.
These instructions will get the XCS application running on Ubuntu for production.
- Docker (available here)
- Singularity (available here)
- AWS CLI (available here)
- AWS RDS, S3, SQS
- PostgreSQL
- Python3
-
Install Apache:
sudo apt install apache2 libapache2-mod-wsgi-py3
-
Clone this repository and activate a virtual environment:
git clone https://github.com/xtracthub/xtract-container-service cd xtract-container-service virtualenv venv source venv/bin/activate
-
Configure the AWS CLI:
aws configure
-
Create a symbolic link to the
/var/www/html/flaskapp
folder:sudo ln -sT ~/xtract-container-service /var/www/html/flaskapp
-
In
flaskapp.wsgi
, set your Globus Auth and AWS credentials. -
In
/etc/apache2/sites-enabled/000-default.conf
, add the following after theDocumentRoot /var/www/html
line:WSGIDaemonProcess flaskapp threads=5 python-path=/var/www/html/flaskapp/venv/lib/python3.6/site-packages WSGIScriptAlias / /var/www/html/flaskapp/flaskapp.wsgi WSGIPassAuthorization On <Directory flaskapp> WSGIProcessGroup flaskapp WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory>
-
Allow Apache to run Docker as a non-root user:
sudo groupadd docker sudo usermod -aG docker www-data sudo newgrp docker
-
Restart Apache:
sudo service apache2 restart
-
In one terminal, ensure that Docker is stopped and start the Docker daemon:
sudo systemctl stop docker sudo dockerd
XCS is a REST API so all interactions can be made with Python's request library. Examples of how to make requests can be found in app_demo.ipynb
(New SDK coming soon)