Commit 9423d064 authored by Anton Akhmerov's avatar Anton Akhmerov

Merge branch 'conda-environment' into 'master'

Run Redis from Conda and add environment.yml

Closes #237 and #313

See merge request !152
parents cdd2fb7b cb3d7d25
# This base image can be found in 'Dockerfile'
image: zesje/base
image: gitlab.kwant-project.org:5005/zesje/zesje/test:latest
stages:
- build
......@@ -13,11 +13,13 @@ stages:
paths:
- .yarn-cache
before_script:
- source activate zesje-dev
- yarn install --cache-folder .yarn-cache
.python_packages: &python_packages
before_script:
- pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
- source activate zesje-dev
- conda env update
build:
<<: *node_modules
......
FROM archlinux/base
## Install packages and clear the cache after installation. Yarn is fixed at 1.6.0 untill 1.8.0 is released due to a critical bug.
RUN pacman -Sy --noconfirm nodejs python-pip git libdmtx libsm libxrender libxext gcc libmagick6 imagemagick ghostscript; \
pacman -U --noconfirm https://archive.archlinux.org/packages/y/yarn/yarn-1.6.0-1-any.pkg.tar.xz
WORKDIR ~
ADD requirements*.txt ./
#ADD package.json .
RUN pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt;
#RUN yarn install; \
# yarn cache clean; \
# rm package.json
FROM continuumio/miniconda3
RUN apt-get update -y && apt-get install -y libdmtx0a libmagickwand-dev
WORKDIR /app
ADD environment.yml /app/environment.yml
RUN conda env create
# From https://medium.com/@chadlagore/conda-environments-with-docker-82cdc9d25754
RUN echo "source activate $(head -1 /app/environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /opt/conda/envs/$(head -1 /app/environment.yml | cut -d' ' -f2)/bin:$PATH
RUN rm /app/environment.yml
CMD bash
\ No newline at end of file
......@@ -15,10 +15,11 @@ Install Miniconda by following the instructions on this page:
https://conda.io/miniconda.html
Create a Conda environment that you will use for installing all
of zesje's dependencies:
Make sure you cloned this repository and enter its directory. Then
create a Conda environment that will automatically install all
of zesje's Python dependencies:
conda create -c conda-forge -n zesje-dev python=3.6 yarn
conda env create # Creates an environment from environment.yml
Then, *activate* the conda environment:
......@@ -31,10 +32,6 @@ Install all of the Javascript dependencies:
yarn install
Install all of the Python dependencies:
pip install -r requirements.txt -r requirements-dev.txt
Unfortunately there is also another dependency that must be installed
manually for now (we are working to bring this dependency into the
Conda ecosystem). You can install this dependency in the following way
......@@ -145,10 +142,10 @@ If you use Atom, install the [linter-js-standard-engine](https://atom.io/package
### Adding dependencies
#### Server-side
If you start using a new Python library, be sure to add it to `requirements.txt`. Python libraries for the testing are in `requirements-dev.txt`.
The packages can be installed and updated in your environment by `pip` using
If you start using a new Python library, be sure to add it to `environment.yml`.
The packages can be installed and updated in your environment by `conda` using
pip install -r requirements.txt -r requirements-dev.txt
conda env update
#### Client-side
......
name: zesje-dev
channels:
- conda-forge
- anaconda
dependencies:
- python=3.6
- yarn
- redis
- pip
- pip:
# Core components
- flask
- flask_restful
- flask_sqlalchemy
- sqlalchemy
- Flask-Migrate
- alembic
- pyyaml
- celery
- redis
# General utilities
- numpy
- scipy
# summary plot generation
- matplotlib
- seaborn
# PDF generation
- pdfrw
- reportlab
- Wand
- Pillow # also scan processing
- pyStrich # TODO: can we replace this with stuff from pylibdmtx?
# Scan processing
- opencv-python
- git+https://github.com/mstamy2/PyPDF2
- pylibdmtx
# Exporting
- pandas
- openpyxl # required for writing dataframes as Excel spreadsheets
#
# Development dependencies
#
# Tests
- pytest
- pyssim
- pytest-cov
# Linting
- flake8
......@@ -3,7 +3,7 @@
"main": "index.js",
"license": "AGPL-3.0",
"scripts": {
"dev": "concurrently --kill-others --names \"WEBPACK,PYTHON,CELERY\" --prefix-colors \"bgBlue.bold,bgGreen.bold,bgRed.bold\" \"webpack-dev-server --hot --inline --progress --config webpack.dev.js\" \"ZESJE_SETTINGS=$(pwd)/zesje.dev.cfg python3 zesje\" \"ZESJE_SETTINGS=$(pwd)/zesje.dev.cfg celery -A zesje.celery worker -l info --autoscale=4,1 --max-tasks-per-child=16\"",
"dev": "concurrently --kill-others --names \"WEBPACK,PYTHON,CELERY,REDIS\" --prefix-colors \"bgBlue.bold,bgGreen.bold,bgRed.bold,bgYellow.bold\" \"webpack-dev-server --hot --inline --progress --config webpack.dev.js\" \"ZESJE_SETTINGS=$(pwd)/zesje.dev.cfg python3 zesje\" \"ZESJE_SETTINGS=$(pwd)/zesje.dev.cfg celery -A zesje.celery worker -l info --autoscale=4,1 --max-tasks-per-child=16\" \"redis-server redis.conf\"",
"build": "webpack --config webpack.prod.js",
"ci": "yarn lint; yarn test",
"lint": "yarn lint:js; yarn lint:py",
......
port 6479
loglevel notice
\ No newline at end of file
# Tests
pytest
pyssim
pytest-cov
# Linting
flake8
# Core components
flask
flask_restful
flask_sqlalchemy
sqlalchemy
Flask-Migrate
alembic
pyyaml
celery
redis
# General utilities
numpy
scipy
# summary plot generation
matplotlib
seaborn
# PDF generation
pdfrw
reportlab
Wand
Pillow # also scan processing
pyStrich # TODO: can we replace this with stuff from pylibdmtx?
# Scan processing
opencv-python
git+https://github.com/mstamy2/PyPDF2
pylibdmtx
# Exporting
pandas
openpyxl # required for writing dataframes as Excel spreadsheets
......@@ -33,8 +33,8 @@ def create_app():
)
app.config.update(
CELERY_BROKER_URL='redis://localhost:6379',
CELERY_RESULT_BACKEND='redis://localhost:6379'
CELERY_BROKER_URL='redis://localhost:6479',
CELERY_RESULT_BACKEND='redis://localhost:6479'
)
db.init_app(app)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment