Skip to content

Commit

Permalink
Merge pull request #886 from onaio/easy-install
Browse files Browse the repository at this point in the history
Easy install.
  • Loading branch information
pld authored Jan 27, 2017
2 parents 00ccd12 + 3bcfea3 commit 1fd20b9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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\`"
39 changes: 36 additions & 3 deletions install.md
Original file line number Diff line number Diff line change
@@ -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';\""
Expand All @@ -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

Expand Down Expand Up @@ -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

5 changes: 0 additions & 5 deletions requirements/makefile_dependencies.pip

This file was deleted.

0 comments on commit 1fd20b9

Please sign in to comment.