diff --git a/Makefile b/Makefile index 48d160d5e0..876460ef36 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ blank: - @echo "Downloading ona core dependencies and running migrations for you (hopefully into a virtualenv)... \n (This will take a while, go grab a coffee or something.)\n\n" - python2 -m pip install -r requirements/makefile_dependencies.pip - python2 -m pip install -e . - python2 manage.py syncdb --noinput - python2 manage.py migrate - @echo "Start the app with \`python2 manage.py runserver --nothreading\`" + @echo "Downloading ona core dependencies and running migrations for you (hopefully into a virtualenv)... \n (This will take a while, go grab a coffee or something.)\n\n" + python2 -m pip install -r requirements/base.pip + python2 -m pip install -r requirements/dev.pip + python2 manage.py migrate + @echo "Start the app with \`python2 manage.py runserver --nothreading\`" diff --git a/install.md b/install.md index 4bb8b7ec0f..ab76a46ac1 100644 --- a/install.md +++ b/install.md @@ -1,8 +1,10 @@ -# Ubuntu installation instructions -## Prepare Os +# Ubuntu installation instructions. +## Prepare OS $ ./script/install/ubuntu ## Database setup + +### In the base OS Replace username and db name accordingly. sudo su postgres -c "psql -c \"CREATE USER onadata WITH PASSWORD 'onadata';\"" @@ -11,6 +13,38 @@ Replace username and db name accordingly. sudo su postgres -c "psql -d onadata -c \"CREATE EXTENSION IF NOT EXISTS postgis;\"" sudo su postgres -c "psql -d onadata -c \"CREATE EXTENSION IF NOT EXISTS postgis_topology;\"" +### In Docker +These are just examples and you shouldn't run them as they are in production: +Use the Dockerfile in [onaio/docker-builds](https://github.com/onaio/docker-builds/tree/master/postgres) for postgres 9.6.0 with postgis 2.3.0. +``` +$ mkdir ~/docker-images/postgres-9.6/ +$ cd ~/docker-images/postgres-9.6 +$ docker build -t postgres:9.6.0 . +``` + +To run it. + +> This will be a persistent using ~/postgresql/data + +``` +$ mkdir ~/postgresql/data +$ docker run -e POSTGRES_PASSWORD=pass -p 5432:5432 --volume ~/postgresql/data:/var/lib/postgresql/data --name onadata -d postgres:9.6.0 +``` + +Connect using psql with: +`psql -h localhost -p 5432 -U postgres` + +In psql: +``` +CREATE USER onadata WITH PASSWORD 'pass' +CREATE DATABASE onadata OWNER onadata +CONNECT onadata +CREATE EXTENSION IF NOT EXISTS postgis +CREATE EXTENSION IF NOT EXISTS postgis_topology;\"" +``` + +From now onwards start your DB with `docker start onadata` provided you passed the name "onadata" to Docker's `--name` option. + ## Get the code git clone https://github.com/onaio/onadata.git @@ -65,4 +99,3 @@ You may at this point start core with `$ python manage.py runserver --nothreadin # remove default nginx server config sudo unlink /etc/nginx/sites-enabled/default sudo service nginx restart - diff --git a/requirements/makefile_dependencies.pip b/requirements/makefile_dependencies.pip deleted file mode 100644 index d8c185a3df..0000000000 --- a/requirements/makefile_dependencies.pip +++ /dev/null @@ -1,5 +0,0 @@ --e git+https://github.com/onaio/pyxform.git@onaio#egg=pyxform --e git+https://github.com/jbalogh/django-nose.git#egg=django-nose --e git+https://github.com/onaio/python-json2xlsclient.git#egg=j2xclient --e git+https://github.com/onaio/django-cors-headers.git@allow-all-for-url#egg=cors-headers -https://bitbucket.org/fomcl/savreaderwriter/downloads/savReaderWriter-3.3.0.zip