Commit e87b2f5a authored by delanoe's avatar delanoe

[INSTALL] Docker install.

parent 94d3f771
``` #!/bin/bash
#!bin/bash
#name:01-setup #name:01-setup
#TODO clone the repo into /srv/gargantext/ and reduce the different steps
#git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
# && cd /srv/gargantext \
# && git fetch origin stable \
# && git checkout stable \
echo "****************SETUP**************************"; echo "****************SETUP**************************";
for dir in "/srv/gargantext_lib" "/srv/gargantext_static" "/srv/gargantext_media"; do for dir in "/srv/gargantext_lib" "/srv/gargantext_static" "/srv/gargantext_media"; do
sudo mkdir -p $dir ; sudo mkdir -p $dir ;
sudo chown gargantua:gargantua $dir ; sudo chown gargantua:gargantua $dir ;
done; done;
sudo wget http://dl.gargantext.org/gargantext_lib.tar.bz2 \ #here gargantext_lib.tar.bz2 inside this directory
&& sudo tar xvjf gargantext_lib.tar.bz2 -o /srv/gargantext_lib \
#sudo 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 \ && sudo chown -R gargantua:gargantua /srv/gargantext_lib \
&& echo ":::::::::::::::::Done::::::::::::::::::::::::::"; && echo ":::::::::::::::::Done::::::::::::::::::::::::::";
#TODO clone the repo into /srv/gargantext/ and reduce the different steps
#git clone ssh://gitolite@delanoe.org:1979/gargantext /srv/gargantext \
# && cd /srv/gargantext \
# && git fetch origin stable \
# && git checkout stable \
```
#!/bin/bash #!/bin/bash
#configure the base image gargamelle #configure the base image gargamelle
echo '****************BUILD**********************************' #echo '::::: BUILD :::::'
docker build -t gargamelle:latest ./gargamelle
#2 option with this image: sudo docker build -t gargamelle:latest ./gargamelle
# configure the container
# run the image with the app in it
echo '::::::::::::::::::::GARGAMELLE IMAGE BUILT:::::::::::::'
echo '*************CONFIG************************************'
sudo docker run \ echo '::::: CONFIG :::::'
-v /srv/:/srv/ \
-p 8000 \
-p 5432 \
-it gargamelle:latest \
/bin/bash -c "/srv/gargantext/install/gargamelle/psql_configure.sh"
sudo docker rm -f `docker ps -a | grep -v CONTAINER | awk '{print $1 }'`
sudo docker run \ sudo docker run \
-v /srv/:/srv/ \ -v /srv/:/srv/ \
-p 8000 \ -p 8000:8000 \
-p 5432 \ -p 5432 \
-it gargamelle:latest \ -it gargamelle:latest \
/bin/bash -c "/srv/gargantext/install/gargamelle/django_configure.sh" /bin/bash -c "./psql_configure.sh; ./django_configure.sh ; exit"
sudo docker rm -f `docker ps -a | grep -v CONTAINER | awk '{print $1 }'`
sudo docker rm -f `docker ps -a | grep -v CONTAINER awk '{print $1 }'`
#!/bin/bash #!/bin/bash
sudo docker run \ sudo docker run \
-v /srv/:/srv/\ -v /srv/:/srv/\
-p 8000 \ -p 8000:8000 \
-p 5432 \ -p 5432 \
-it gargamelle:latest \ -it gargamelle:latest \
# /bin/bash -c "service postgresql start; su gargantua -c \'source /env_3-5/bin/activate && /srv/gargantext/manage.py runserver 0.0.0.0:8000\'" /bin/bash -c "service postgresql start; /bin/su gargantua -c 'source /env_3-5/bin/activate && /srv/gargantext/manage.py runserver 0.0.0.0:8000'"
sudo docker rm -f `docker ps -a | grep -v CONTAINER | awk '{print $1 }'`
# Install
Gargamelle is a developpement environemment to install configure and run Gargantext plateform.
## Prerequisites
* MaC or Debian based OS
* Git
* Docker engine
## Installation Procedure
* Clone the repository
If you want to contribute see our [git workflow procedure](../tools/git.md)
clone the repo and switch to your own branch named with username-branchname such as username-unstable for example
Inside the repository (install)
you will find the setup config and run procedure files
cd gargantext/install/
```
./01-setup
./02-config #here you will have to choose a username & a password for gargantext
./03-run
```
Open your browser Chrome perferably at localhost:8000
click into enter and login!
Enjoy ;)!
...@@ -5,11 +5,6 @@ ...@@ -5,11 +5,6 @@
# wich contains all the source code of the app # wich contains all the source code of the app
FROM debian:stretch FROM debian:stretch
MAINTAINER ISCPIF <gargantext@iscpif.fr> MAINTAINER ISCPIF <gargantext@iscpif.fr>
# Configure global ENV with deb dependencies
# Configure local ENV requirements
########################################################################
ENV DEBIAN_FRONTEND noninteractive
USER root USER root
...@@ -84,4 +79,7 @@ RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.co ...@@ -84,4 +79,7 @@ RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.co
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
EXPOSE 5432 8000 EXPOSE 5432 8000
VOLUME ["/srv/",] VOLUME ["/srv/",]
...@@ -8,17 +8,23 @@ ...@@ -8,17 +8,23 @@
################################################## ##################################################
#configure django migrations #configure django migrations
################################################## ##################################################
echo "::::: DJANGO :::::"
#echo "Starting Postgres"
#/usr/sbin/service postgresql start
echo "Starting Postgres" /bin/su gargantua -c 'source /env_3-5/bin/activate &&\
/usr/sbin/service postgresql start echo "Activated env" &&\
./srv/gargantext/manage.py makemigrations &&\
./srv/gargantext/manage.py migrate && \
echo "migrations ok" &&\
./srv/gargantext/dbmigrate.py && \
./srv/gargantext/dbmigrate.py && \
./srv/gargantext/dbmigrate.py && \
./srv/gargantext/manage.py createsuperuser'
/bin/su gargantua -c 'source /env_3-5/bin/activate \
&& ./srv/gargantext/manage.py makemigrations \
&& ./srv/gargantext/manage.py migrate \
&& ./srv/gargantext/dbmigrate.py \
&& ./srv/gargantext/dbmigrate.py \
&& ./srv/gargantext/dbmigrate.py;'
/usr/sbin/service postgresql stop /usr/sbin/service postgresql stop
...@@ -8,25 +8,16 @@ ...@@ -8,25 +8,16 @@
## |_| \___/|___/\__\__, |_| \___||___/ ## |_| \___/|___/\__\__, |_| \___||___/
## |___/ ## |___/
####################################################################### #######################################################################
echo "::::: POSTGRESQL :::::"
service postgresql stop su postgres -c 'pg_dropcluster 9.4 main --stop'
su postgres -c 'pg_dropcluster 9.5 main --stop'
#done in docker but redoing it #done in docker but redoing it
rm -rf /srv/gargandata && mkdir /srv/gargandata && chown postgres:postgres /srv/gargandata
if [[ -e "/srv/gargandata" ]]; then
rm -rf /srv/gargandata/*
else
mkdir /srv/gargandata;
chown -R postgres:postgres /srv/gargandata
fi
su postgres -c '/usr/lib/postgresql/9.5/bin/initdb -D /srv/gargandata/' su postgres -c '/usr/lib/postgresql/9.5/bin/initdb -D /srv/gargandata/'
su postgres -c '/usr/lib/postgresql/9.5/bin/pg_ctl -D /srv/gargandata/ -l journal_applicatif start' su postgres -c '/usr/lib/postgresql/9.5/bin/pg_ctl -D /srv/gargandata/ -l journal_applicatif start'
su postgres -c 'pg_createcluster -D /srv/gargandata 9.5 main '
#su postgres -c 'pg_createcluster -D /srv/gargandata 9.5 main ' su postgres -c 'pg_ctlcluster -D /srv/gargandata 9.5 main start '
#su postgres -c 'pg_ctlcluster -D /srv/gargandata 9.5 main start ' su postgres -c 'pg_ctlcluster 9.5 main start'
service postgresql start service postgresql start
...@@ -34,4 +25,5 @@ su postgres -c "psql -c \"CREATE user gargantua WITH PASSWORD 'C8kdcUrAQy66U'\"" ...@@ -34,4 +25,5 @@ su postgres -c "psql -c \"CREATE user gargantua WITH PASSWORD 'C8kdcUrAQy66U'\""
su postgres -c "createdb -O gargantua gargandb" su postgres -c "createdb -O gargantua gargandb"
echo "Postgres configured" echo "Postgres configured"
service postgresql stop
...@@ -32,5 +32,3 @@ lxml==3.5.0 ...@@ -32,5 +32,3 @@ lxml==3.5.0
requests-futures==0.9.7 requests-futures==0.9.7
bs4==0.0.1 bs4==0.0.1
requests==2.10.0 requests==2.10.0
#testing github
#-e git://github.com/zzzeek/sqlalchemy.git@rel_1_1
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