Commit ef4ba14a authored by delanoe's avatar delanoe

Merge remote-tracking branch 'origin/c24b-refact' into merge

parents 46cb23cd 5ea57a02
Gargantext
#Gargantext
==========
Install Instructions for Gargantext (CNRS):
1. [SETUP](##SETUP)
2. [INSTALL](##INSTALL)
3. [RUN](##RUN)
## Help needed ?
See http://gargantext.org/about and tools for the community
##SETUP
Prepare your environnement
Create user gargantua
Main user of Gargantext is Gargantua (role of Pantagruel soon)!
``` bash
sudo adduser --disabled-password --gecos "" gargantua
```
Create the directories you need
``` bash
for dir in "/srv/gargantext"
"/srv/gargantext_lib"
"/srv/gargantext_static"
"/srv/gargantext_media"
"/srv/env_3-5"; do
sudo mkdir -p $dir ;
sudo chown gargantua:gargantua $dir ;
done
```
You should see:
```bash
$tree /srv
/srv
├── gargantext
├── gargantext_lib
├── gargantext_media
│   └── srv
│   └── env_3-5
├── gargantext_static
└── lost+found [error opening dir]
```
## Get the source code of Gargantext
Clone the repository of gargantext
``` bash
git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
&& cd /srv/gargantext \
&& git fetch origin refactoring \
&& git checkout refactoring \
```
**Optionnal**: if you want to contribute clone the repo into your own branch
``` bash
git checkout -b username-refactoring refactoring
```
! TODO (soon) : git clone https://gogs.iscpif.fr/gargantext.git
## SETUP
Build your OS dependencies
2 ways, for each you need to install Debian GNU/Linux dependencies.
1. [EASY] [Docker way](#DOCKER)
2. [EXPERT] [Debian way](#DEBIAN)
### DOCKER
* Install docker
See [installation instruction for your distribution](https://docs.docker.com/engine/installation/)
#### Build your docker image
``` bash
cd /srv/gargantext/install/docker/dev
./build
```
You should see
```
Successfully built <container_id>
```
#### Enter into the docker environnement
``` bash
./srv/gargantext/install/docker/enterGargantextImage
```
#### Install Python environment
Inside the docker image, execute as root:
``` bash
/srv/gargantext/install/python/configure
```
#### Configure PostgreSql
Inside the docker image, execute as root:
``` bash
/srv/gargantext/install/postgres/configure
```
#### Exit the docker
``` exit
```
#### Get main librairies
Can be long, so be patient :)
``` bash
wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \
&& tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
&& sudo chown -R gargantua:gargantua /srv/gargantext_lib \
&& echo "Libs installed"
```
### DEBIAN
[EXPERTS] Debian way (directory install/debian)
## INSTALL Gargantext
### Enter docker container
``` bash
/srv/gargantext/install/docker/enterGargantextImage
```
### Inside docker container configure the database
``` bash
service postgresql start
su gargantua
source /srv/env_3-5/bin/activate
python /srv/gargantext/dbmigrate.py
/srv/gargantext/manage.py migrate
python /srv/gargantext/dbmigrate.py
python /srv/gargantext/dbmigrate.py
echo "TODO: Init first user"
```
FIXME: dbmigrate need to launched several times since tables are
ordered with alphabetical order (and not dependencies order)
### Inside docker container launch Gargantext
``` bash
service postgresql start
su gargantua
source /srv/env_3-5/bin/activate
/srv/gargantext/manage.py runserver 0.0.0.0:8000
python /srv/gargantext/init_accounts.py /srv/gargantext/install/init/account.csv
```
## RUN
### Outside docker container launch browser
``` bash
chromium http://127.0.0.1:8000/
```
Click on Test Gargantext
Login : gargantua
Password : autnagrag
Enjoy :)
=======
Install Instructions for Gargantext (CNRS).
1. [SETUP](##SETUP)
......@@ -15,12 +180,23 @@ Prepare your environnement
Build your OS dependencies inside a docker
<<<<<<< HEAD
Main user of Gargantext is Gargantua (role of Pantagruel soon)!
>>>>>>> constance-docker
=======
>>>>>>> 8eac65c6d225deb05948c583367e8540ad95316d
``` bash
cd /srv/gargantext/install/docker/dev
./build
```
<<<<<<< HEAD
<<<<<<< HEAD
=======
## Create the directories you need
=======
## INSTALL
### Enter docker container
......@@ -29,15 +205,16 @@ cd /srv/gargantext/install/docker/dev
```
### Create the directories you need
>>>>>>> 8eac65c6d225deb05948c583367e8540ad95316d
``` bash
for dir in "/srv/gargantext"
"/srv/gargantext_lib"
"/srv/gargantext_static"
"/srv/gargantext_media"
"/srv/env_3-5"; do
"/srv/env_3-5"; do
sudo mkdir -p $dir ;
sudo chown gargantua:gargantua $dir ;
sudo chown gargantua:gargantua $dir ;
done
```
......
# Gargantext Installation
You will find here a Dockerfile and docker-compose script
that builds a development container for Gargantex
along with a PostgreSQL 9.5.X server.
* Install Docker
On your host machine, you need Docker.
[Installation guide details](https://docs.docker.com/engine/installation/#installation)
* clone the gargantex repository and get the refactoring branch
```
git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext
cd /srv/gargantext
git fetch origin refactoring
git checkout refactoring
Install additionnal dependencies into gargantex_lib
```
wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \
&& sudo tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
&& sudo chown -R gargantua:gargantua /srv/gargantext_lib \
```
* Developers: create your own branch based on refactoring
see [CHANGELOG](CHANGELOG.md) for migrations and branches name
```
git checkout-b username-refactoring refactoring
```
Build the docker images:
- a database container
- a gargantext container
```
cd /srv/gargantext/install/
docker-compose build -t gargantex /srv/gargantext/install/docker/config/
docker-compose run web bundle install
```
Finally, setup the PostgreSQL database with the following commands.
```
docker-compose run web bundle exec rake db:create
docker-compose run web bundle exec rake db:migrate
docker-compose run web bundle exec rake db:seed
```
## OS
## Debian Stretch
......@@ -9,7 +54,7 @@ If you do not have a Debian environment, then install docker and
execute /srv/gargantext/install/docker/dev/install.sh
You need a docker image.
All the steps are explained in docker/dev/install.sh (not automatic yet).
All the steps are explained in [docker/dev/install.sh](docker/dev/install.sh) (not automatic yet).
Bug reports are welcome.
......
###########################################################
# ____ ____ _____ __ ___ #
# / ___| __ _ _ __ / ___| __ _ _ _|_ _|__\ \/ / |_ #
# | | _ / _` | '__| | _ / _` | '_ \| |/ _ \\ /| __| #
# | |_| | (_| | | | |_| | (_| | | | | | __// \| |_ #
# \____|\__,_|_| \____|\__,_|_| |_|_|\___/_/\_\\__| #
# #
###########################################################
######################################################################
#Build an image starting with debian:stretch image
FROM debian:stretch
MAINTAINER ISCPIF <alexandre.delanoe@iscpif.fr>
######################################################################
#Add the current image into /srv/
ADD . /srv/
#Set the working directory to /srv
WORKDIR /srv/
#Install the debian dependencies
#as root
USER root
#declare 2 environnement
ENV GG_ROOT /srv/gargantext
ENV PYTHON_ENV /srv/env_3-5
RUN apt-get update && \
apt-get install -y \
apt-utils ca-certificates locales \
sudo aptitude gcc g++ wget git postgresql-9.5 vim
### Configure timezone and locale
RUN echo "Europe/Paris" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata && \
sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen && \
sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="fr_FR.UTF-8"' > /etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=fr_FR.UTF-8
### Install Database, main dependencies and Python
### (installing some Debian version before pip to get dependencies)
RUN apt-get update && apt-get install -y \
postgresql-server-dev-9.5 libpq-dev libxml2 \
libxml2-dev xml-core libgfortran-5-dev \
virtualenv python3-virtualenv \
python3.4 python3.4-dev \
python3.5 python3.5-dev \
python3-six python3-numpy python3-setuptools \
# ^for numpy, pandas
python3-numexpr \
# ^ for numpy performance
libxml2-dev libxslt-dev
# ^ for lxml
#libxslt1-dev zlib1g-dev
RUN apt-get install -qy python3.5
RUN apt-get install -qy python3-pip
RUN python3-pip install -r /srv/gargantex/install/python/requirements.txt
### PROD VERSION OF GARGANTEXT ONLY
#RUN apt-get install -y uwsgi nginx uwsgi-plugin-python rabbitmq-server
## CREATE USER and adding it to sudo >> docker-compose build
## TODO ask user for password
#RUN adduser --disabled-password --gecos "" gargantua
#RUN apt-get install -y sudo && adduser gargantua sudo \
# && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
#######################################################################
### CONFIGURE POSTGRESQL
#######################################################################
#in docker database
#RUN sed -iP 's%^data_directory.*%data_directory = '\/srv\/gargantext_data'%' /etc/postgresql/9.5/main/postgresql.conf
######################################################################
default: &default
adapter: postgresql
encoding: unicode
pool: 5
host: postgres
port: 5432
username: gargantex
password: gargantex
development:
database: gargantex_dev
test:
database: gargantext_test
postgres:
image: "postgres:9.5"
volumes_from:
- data
expose:
- 5432
environment:
POSTGRES_PASSWORD: gargantext
POSTGRES_USER: gargantua
web:
command: python manage.py runserver 0.0.0.0:8000
build: .
volumes:
- .:/srv/
ports:
- "8000:8000"
depends_on:
- db
build: .
ports:
- "3000:3000"
links:
- postgres
volumes:
- ../:/srv/
volumes_from:
- data
environment:
HOST: 0.0.0.0
PORT: 3000
data:
image: gargantext
command: echo 'Data Container for PostgreSQL and Initial Data'
volumes:
- /var/lib/postgresql/data
- /bundler
#!/bin/bash
# Main user of Gargantext is Gargantua (role of Pantagruel soon)!
#sudo adduser --disabled-password --gecos "" gargantua
#######################################################################
# ____ _
# | _ \ ___ ___| | _____ _ __
# | | | |/ _ \ / __| |/ / _ \ '__|
# | |_| | (_) | (__| < __/ |
# |____/ \___/ \___|_|\_\___|_|
#
######################################################################
sudo docker build -t gargantext .
# OR
# cd /tmp
# wget http://dl.gargantext.org/gargantext_docker_image.tar \
# && sudo docker import - gargantext:latest < gargantext_docker_image.tar
function do_cker {
#sudo docker run -d -p 8000:8000 \
sudo docker run -d \
-v /srv2:/srv \
-v /home/alexandre:/home/alexandre \
-t gargantext:latest \
/bin/bash $1
}
#######################################################################
# _____ _ _
# | ___|__ | | __| | ___ _ __ ___
# | |_ / _ \| |/ _` |/ _ \ '__/ __|
# | _| (_) | | (_| | __/ | \__ \
# |_| \___/|_|\__,_|\___|_| |___/
#
#######################################################################
### Create directories in /srv
# Linux only
function create_folders {
for dir in "/srv/gargantext"\
"/srv/gargantext_lib"\
"/srv/gargantext_static"\
"/srv/gargantext_media"\
"/srv/gargantext_data"\
"/srv/env_3-5"; do \
sudo mkdir -p $dir ;\
sudo chown gargantua:gargantua $dir ; \
done;\
sudo chown -R postgres:postgres /srv/gargantext_data/
}
#do_cker "create_folders"
#NOPE
function git_config {
### TODO (soon) : git clone https://gogs.iscpif.fr/gargantext.git
git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
&& cd /srv/gargantext \
&& git fetch origin refactoring \
&& git checkout refactoring
}
#su gargantua -c git_config #NOPE
#######################################################################
## ____ _
## | _ \ ___ ___| |_ __ _ _ __ ___ ___
## | |_) / _ \/ __| __/ _` | '__/ _ \/ __|
## | __/ (_) \__ \ || (_| | | | __/\__ \
## |_| \___/|___/\__\__, |_| \___||___/
## |___/
#######################################################################
#NOPE
function postgres_config {
/usr/lib/postgresql/9.5/bin/initdb -D /srv/gargantext_data/
}
#do_cker "su postgres -c postgres_config"
function postgres_create_db {
sudo /etc/init.d/postgresql start \
&& psql -c "CREATE user gargantua WITH PASSWORD 'C8kdcUrAQy66U'" \
&& createdb -O gargantua gargandb \
&& echo "Root: END of the installation of Gargantexts Database by postgres."
}
#do_cker postgres_create_db
#######################################################################
## _ _ _ _ _
## | | (_) |__ _ __ __ _(_)_ __(_) ___ ___
## | | | | '_ \| '__/ _` | | '__| |/ _ \/ __|
## | |___| | |_) | | | (_| | | | | | __/\__ \
## |_____|_|_.__/|_| \__,_|_|_| |_|\___||___/
##
#######################################################################
#
#######################################################################
### INSTALL MAIN DEPENDENCIES
#######################################################################
###
#### Installing pip version of python libs
#
function install_python_env {
/usr/bin/virtualenv --py=/usr/bin/python3.5 /srv/env_3-52 \
&& /bin/bash -c 'source /srv/env_3-52/bin/activate' \
&& /bin/bash -c '/srv/env_3-52/bin/pip install git+https://github.com/zzzeek/sqlalchemy.git@rel_1_1' \
&& /bin/bash -c '/srv/env_3-52/bin/pip install -r /srv/gargantext/install/python/requirements.txt'
}
#do_cker "su gargantua -c install_python_env"
#######################################################################
function init_gargantext {
echo "TODO script pour peupler la base"
}
#do_cker "su gargantua -c init_gargantext"
#######################################################################
### GET CONFIG FILES
function get_libs {
wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \
&& tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
&& sudo chown -R gargantua:gargantua /srv/gargantext_lib \
&& echo "Libs installed"
}
#do_cker get_libs
postgres:
image: "postgres:9.4"
volumes_from:
- data
expose:
- 5432
environment:
POSTGRES_PASSWORD: gargantext
POSTGRES_USER: gargantua
web:
build: .
ports:
- "3000:3000"
links:
- postgres
volumes:
- ../:/app/
volumes_from:
- data
environment:
HOST: 0.0.0.0
PORT: 3000
data:
image: cogniteev/echo
command: echo 'Data Container for PostgreSQL and Bundler'
volumes:
- /var/lib/postgresql/data
- /bundler
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