Commit b11d72c3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Docker Container reaching local host database. Need to build a container...

[FIX] Docker Container reaching local host database. Need to build a container with all in it (source code, database, notebooks).
parent a5291d1a
...@@ -2,7 +2,8 @@ from gargantext.util.db import session ...@@ -2,7 +2,8 @@ from gargantext.util.db import session
from gargantext.util.files import upload from gargantext.util.files import upload
from gargantext.constants import * from gargantext.constants import *
from sqlalchemy_utils.types import TSVectorType # Uncomment to make column full text searchable
#from sqlalchemy_utils.types import TSVectorType
from datetime import datetime from datetime import datetime
......
...@@ -9,7 +9,10 @@ import sqlalchemy as sa ...@@ -9,7 +9,10 @@ import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import delete from sqlalchemy import delete
from sqlalchemy_searchable import make_searchable
# To make Full Text search possible, uncomment lines below
# (and install it with pip before)
#from sqlalchemy_searchable import make_searchable
def get_engine(): def get_engine():
from sqlalchemy import create_engine from sqlalchemy import create_engine
......
install/notebook/gargantext_notebook.py
\ No newline at end of file
...@@ -17,7 +17,7 @@ jdatetime==1.7.2 ...@@ -17,7 +17,7 @@ jdatetime==1.7.2
kombu==3.0.37 # messaging kombu==3.0.37 # messaging
langdetect==1.0.6 #detectinglanguage langdetect==1.0.6 #detectinglanguage
nltk==3.1 nltk==3.1
numpy==1.10.4 numpy==1.13.1
psycopg2==2.6.2 psycopg2==2.6.2
pycountry==1.20 pycountry==1.20
python-dateutil==2.4.2 python-dateutil==2.4.2
......
...@@ -4,12 +4,20 @@ ...@@ -4,12 +4,20 @@
#-v /srv/gargantext_lib:/srv/gargantext_lib \ #-v /srv/gargantext_lib:/srv/gargantext_lib \
sudo docker rm $(sudo docker ps -a | grep notebook | grep sh | awk '{print $1}') sudo docker rm $(sudo docker ps -a | grep notebook | grep sh | awk '{print $1}')
#HOSTIP=$(ip route show 0.0.0.0/0 | awk '{print $3}')
#--add-host=localhost:${HOSTIP} \
sudo docker run \ sudo docker run \
--name=garg-notebook \ --name=garg-notebook \
-v /srv/gargantext:/srv/gargantext \ --net=host \
-p 8899:8899 \ -p 8899:8899 \
--env POSTGRES_HOST=localhost \
-v /srv/gargantext:/srv/gargantext \
-it garg-notebook:latest \ -it garg-notebook:latest \
/bin/bash -c "/bin/su notebooks -c 'source /env_3-5/bin/activate && jupyter notebook --port=8899 --ip=0.0.0.0 --no-browser --notebook-dir=/home/notebooks/'" /bin/bash -c "/bin/su notebooks -c 'source /env_3-5/bin/activate && cd /srv/gargantext/ && jupyter notebook --port=8899 --ip=0.0.0.0 --no-browser'"
#/bin/bash -c "/bin/su gargantua -c 'source /env_3-5/bin/activate && jupyter notebook --port=8899 --ip=127.0.0.1 --no-browser'" # #&& jupyter nbextension enable --py widgetsnbextension --sys-prefix
#/bin/bash -c "/bin/su notebooks -c 'source /env_3-5/bin/activate && cd /srv/gargantext/ && jupyter notebook --port=8899 --ip=0.0.0.0 --no-browser --notebook-dir=/home/notebooks/'"
...@@ -16,10 +16,10 @@ RUN apt-get update && \ ...@@ -16,10 +16,10 @@ RUN apt-get update && \
apt-utils ca-certificates locales \ apt-utils ca-certificates locales \
sudo aptitude gcc g++ wget git vim \ sudo aptitude gcc g++ wget git vim \
build-essential make \ build-essential make \
curl \ curl
postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 \ # postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 \
postgresql-server-dev-9.6 libpq-dev libxml2 \ # postgresql-server-dev-9.6 libpq-dev libxml2 \
postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6 # postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6
# Install Stack # Install Stack
...@@ -69,7 +69,7 @@ RUN virtualenv /env_3-5 ...@@ -69,7 +69,7 @@ RUN virtualenv /env_3-5
RUN echo 'alias venv="source /env_3-5/bin/activate"' >> ~/.bashrc RUN echo 'alias venv="source /env_3-5/bin/activate"' >> ~/.bashrc
# CONFIG FILES # CONFIG FILES
ADD requirements.txt / ADD requirements.txt /
ADD psql_configure.sh / #ADD psql_configure.sh /
ADD django_configure.sh / ADD django_configure.sh /
RUN . /env_3-5/bin/activate && pip3 install -r requirements.txt && \ RUN . /env_3-5/bin/activate && pip3 install -r requirements.txt && \
...@@ -85,23 +85,23 @@ RUN chown notebooks:notebooks -R /env_3-5 ...@@ -85,23 +85,23 @@ RUN chown notebooks:notebooks -R /env_3-5
### Notebook IHaskell and IPYTHON ENVIRONNEMENT ### Notebook IHaskell and IPYTHON ENVIRONNEMENT
######################################################################## ########################################################################
RUN apt-get update && apt-get install -y \ #RUN apt-get update && apt-get install -y \
libtinfo-dev \ # libtinfo-dev \
libzmq3-dev \ # libzmq3-dev \
libcairo2-dev \ # libcairo2-dev \
libpango1.0-dev \ # libpango1.0-dev \
libmagic-dev \ # libmagic-dev \
libblas-dev \ # libblas-dev \
liblapack-dev # liblapack-dev
RUN curl -sSL https://get.haskellstack.org/ | sh #RUN curl -sSL https://get.haskellstack.org/ | sh
RUN stack setup #RUN stack setup
RUN git clone https://github.com/gibiansky/IHaskell #RUN git clone https://github.com/gibiansky/IHaskell
RUN . /env_3-5/bin/activate \ #RUN . /env_3-5/bin/activate \
&& cd IHaskell \ # && cd IHaskell \
&& stack install gtk2hs-buildtools \ # && stack install gtk2hs-buildtools \
&& stack install --fast \ # && stack install --fast \
&& /root/.local/bin/ihaskell install --stack # && /root/.local/bin/ihaskell install --stack
#
# #
######################################################################## ########################################################################
...@@ -112,6 +112,6 @@ RUN . /env_3-5/bin/activate \ ...@@ -112,6 +112,6 @@ RUN . /env_3-5/bin/activate \
#RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf #RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
#RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf #RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
EXPOSE 8899 EXPOSE 5432 8899
VOLUME ["/srv/","/home/notebooks/"] VOLUME ["/srv/","/home/notebooks/"]
""" """
Gargantext Software Copyright (c) 2016 CNRS ISC-PIF - Gargantext Software Copyright (c) 2016-2017 CNRS ISC-PIF -
http://iscpif.fr http://iscpif.fr
Licence (see : Licence (see :
http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE ) http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE )
...@@ -47,7 +47,7 @@ def documents(corpus_id): ...@@ -47,7 +47,7 @@ def documents(corpus_id):
) )
import seaborn as sns #import seaborn as sns
import pandas as pd import pandas as pd
def chart(docs, field): def chart(docs, field):
......
...@@ -17,7 +17,7 @@ jdatetime==1.7.2 ...@@ -17,7 +17,7 @@ jdatetime==1.7.2
kombu==3.0.37 # messaging kombu==3.0.37 # messaging
langdetect==1.0.6 #detectinglanguage langdetect==1.0.6 #detectinglanguage
nltk==3.1 nltk==3.1
numpy==1.10.4 numpy==1.13.1
psycopg2==2.6.2 psycopg2==2.6.2
pycountry==1.20 pycountry==1.20
python-dateutil==2.4.2 python-dateutil==2.4.2
...@@ -40,3 +40,5 @@ jupyter-console==5.1.0 ...@@ -40,3 +40,5 @@ jupyter-console==5.1.0
jupyter-core==4.3.0 jupyter-core==4.3.0
ipython==5.2.0 ipython==5.2.0
ipython-genutils==0.1.0 ipython-genutils==0.1.0
ipywidgets
matplotlib==2.0.2
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