-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker db decouple #89
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,20 @@ | ||
FROM debian:latest | ||
FROM tiangolo/meinheld-gunicorn-flask:python3.7 | ||
|
||
LABEL authors="[email protected],[email protected]" \ | ||
description="Docker image running MegaQC" | ||
|
||
# Install container-wide requrements | ||
RUN apt-get update && apt-get install git -y && \ | ||
apt-get install python2.7 -y && \ | ||
apt-get install python2.7-dev -y && \ | ||
apt-get install libyaml-dev -y && \ | ||
apt-get install libffi-dev -y && \ | ||
apt-get install libpng-dev -y && \ | ||
apt-get install libfreetype6-dev -y && \ | ||
apt-get install curl -y && \ | ||
apt-get install gcc -y && \ | ||
apt-get install g++ -y && \ | ||
apt-get install apache2 -y | ||
|
||
# Enable apache mod_proxy | ||
RUN a2enmod proxy | ||
RUN a2enmod proxy_http | ||
|
||
# Overwrite apache config | ||
RUN echo "<VirtualHost *:80> \n\ | ||
ServerName megaqc \n\ | ||
ProxyPass / http://127.0.0.1:8000/ \n\ | ||
ProxyPassReverse / http://127.0.0.1:8000/ \n\ | ||
</VirtualHost>" > /etc/apache2/sites-enabled/000-default.conf | ||
|
||
# Fix matplotlib being dumb | ||
RUN ln -s /usr/include/freetype2/ft2build.h /usr/include/ | ||
|
||
# Link python | ||
RUN ln -s /usr/bin/python2.7 /usr/bin/python | ||
|
||
# Install pip | ||
RUN curl -fsSL https://bootstrap.pypa.io/get-pip.py -o /opt/get-pip.py && \ | ||
python /opt/get-pip.py && \ | ||
rm /opt/get-pip.py | ||
|
||
# Install PostgreSQL and psycopg2 | ||
RUN apt-get install postgresql-9.6 postgresql-server-dev-9.6 -y | ||
|
||
# Set data directory | ||
ENV PGDATA /usr/local/lib/postgresql | ||
|
||
# Tell MegaQC to use postgres / psycopg2 | ||
ENV MEGAQC_PRODUCTION 1 | ||
|
||
# create the data directory | ||
RUN mkdir $PGDATA | ||
RUN chown postgres $PGDATA | ||
# Start postgres | ||
# Create the basic requirements | ||
RUN su postgres -c "/usr/lib/postgresql/9.6/bin/initdb" && \ | ||
su postgres -c "/usr/lib/postgresql/9.6/bin/pg_ctl -D $PGDATA -w start" && \ | ||
su postgres -c "/usr/lib/postgresql/9.6/bin/createuser megaqc_user" && \ | ||
su postgres -c "/usr/lib/postgresql/9.6/bin/createdb megaqc -O megaqc_user" && \ | ||
su postgres -c "/usr/lib/postgresql/9.6/bin/pg_ctl -D $PGDATA -w stop" | ||
|
||
# Install MegaQC | ||
COPY . MegaQC | ||
WORKDIR MegaQC | ||
RUN python setup.py install | ||
|
||
# Set up the Postgres SQL server | ||
RUN su postgres -c "/usr/lib/postgresql/9.6/bin/pg_ctl -D $PGDATA -w start" && \ | ||
megaqc initdb && \ | ||
su postgres -c "/usr/lib/postgresql/9.6/bin/pg_ctl -D $PGDATA -w stop" | ||
|
||
# Use volumes to persist logs and data | ||
VOLUME ["/var/log/postgresql", "/usr/local/lib/postgresql"] | ||
|
||
# Run the MegaQC server | ||
EXPOSE 80 | ||
CMD su postgres -c "/usr/lib/postgresql/9.6/bin/pg_ctl -D $PGDATA -w start" && \ | ||
service apache2 start && \ | ||
gunicorn megaqc.wsgi:app --timeout 300 | ||
ENV MEGAQC_PRODUCTION=1 \ | ||
MEGAQC_SECRET="SuperSecretValueYouShouldReallyChange" \ | ||
MEGAQC_CONFIG="" \ | ||
APP_MODULE=megaqc.wsgi:app\ | ||
DB_HOST="127.0.0.1" \ | ||
DB_PORT="5432" \ | ||
DB_NAME="megaqc" \ | ||
DB_USER="megaqc" \ | ||
DB_PASS="megaqcpswd" | ||
|
||
COPY . /app | ||
|
||
RUN python /app/setup.py install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,43 +21,45 @@ | |
"Flask-Caching>=1.0.0", | ||
"Flask-DebugToolbar>=0.10.1", | ||
"Flask-Login>=0.4.0", | ||
"Flask-SQLAlchemy==2.2", | ||
"Flask-WTF==0.14.2", | ||
"Flask-SQLAlchemy>=2.2", | ||
"Flask-WTF>=0.14.2", | ||
"Flask==1.0.2", | ||
"future==0.16.0", | ||
"itsdangerous>=0.24", | ||
"Jinja2>=2.9.5", | ||
"markdown>=2.6.11", | ||
"numpy==1.14.3", | ||
"multiqc>=1.3", | ||
"numpy>=1.14.3", | ||
"passlib==1.7.1", | ||
"plotly==2.0.15", | ||
"pyyaml==3.12", | ||
"pyyaml>=3.12", | ||
"SQLAlchemy>=1.1.5", | ||
"Werkzeug==0.14.1", | ||
"Werkzeug>=0.14.1", | ||
"WTForms>=2.1", | ||
|
||
# Testing | ||
"pytest==3.0.6", | ||
"WebTest==2.0.26", | ||
"factory-boy==2.8.1", | ||
"livereload==2.5.1", | ||
"pytest>=3.0.6", | ||
"WebTest>=2.0.26", | ||
"factory-boy>=2.8.1", | ||
"livereload>=2.5.1", | ||
|
||
# Lint and code style | ||
#"flake8==3.3.0", | ||
#flake8-blind-except==0.1.1", | ||
#"flake8-debugger==1.4.0", | ||
#"flake8-docstrings==1.0.3", | ||
#"flake8-isort==2.1.3", | ||
#"flake8-quotes==0.9.0", | ||
#"isort==4.2.5", | ||
#"pep8-naming==0.4.1", | ||
# "flake8==3.3.0", | ||
# flake8-blind-except==0.1.1", | ||
# "flake8-debugger==1.4.0", | ||
# "flake8-docstrings==1.0.3", | ||
# "flake8-isort==2.1.3", | ||
# "flake8-quotes==0.9.0", | ||
# "isort==4.2.5", | ||
# "pep8-naming==0.4.1", | ||
] | ||
|
||
prod_reqs = dev_reqs + [ | ||
"psycopg2-binary>=2.6.2", | ||
"gunicorn>=19.7.1", | ||
] | ||
install_requires = prod_reqs if os.environ.get('MEGAQC_PRODUCTION') else dev_reqs | ||
install_requires = prod_reqs if os.environ.get( | ||
'MEGAQC_PRODUCTION') else dev_reqs | ||
|
||
|
||
print("""----------------------------------- | ||
|
@@ -67,22 +69,23 @@ | |
""".format(version)) | ||
|
||
setup( | ||
name = 'megaqc', | ||
version = version, | ||
author = 'Phil Ewels', | ||
author_email = '[email protected]', | ||
description = "Collect and visualise data across multiple MultiQC runs", | ||
long_description = __doc__, | ||
keywords = ['bioinformatics', 'biology', 'sequencing', 'NGS', 'next generation sequencing', 'quality control'], | ||
url = 'https://megaqc.info/', | ||
download_url = 'https://github.com/ewels/MegaQC/releases', | ||
license = 'GPLv3', | ||
packages = ['megaqc'], | ||
include_package_data = True, | ||
zip_safe = False, | ||
scripts = ['scripts/megaqc'], | ||
install_requires = install_requires, | ||
classifiers = [ | ||
name='megaqc', | ||
version=version, | ||
author='Phil Ewels', | ||
author_email='[email protected]', | ||
description="Collect and visualise data across multiple MultiQC runs", | ||
long_description=__doc__, | ||
keywords=['bioinformatics', 'biology', 'sequencing', 'NGS', | ||
'next generation sequencing', 'quality control'], | ||
url='https://megaqc.info/', | ||
download_url='https://github.com/ewels/MegaQC/releases', | ||
license='GPLv3', | ||
packages=['megaqc'], | ||
include_package_data=True, | ||
zip_safe=False, | ||
scripts=['scripts/megaqc'], | ||
install_requires=install_requires, | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Environment :: Console', | ||
'Environment :: Web Environment', | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here