From 7e84c9fac7d236417dca50a9d32fe030159693d5 Mon Sep 17 00:00:00 2001 From: Ilkka Oksanen Date: Fri, 24 Feb 2017 15:01:37 +0200 Subject: [PATCH] add docker installation guide to readme.md --- readme.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 926e5ae..e2f5b5d 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,55 @@ # SIKWEB 2.0 -## Installation +## Installation with docker + +### installing docker + +install docker and docker-compose. On ubuntu this can be done with + +```BASH +sudo apt-get install docker docker-compose +``` + +### Configuring db-image + +```BASH +sudo docker-compose up db +# then configure following with another shell window +sudo docker exec -ti bash # image name can be found with sudo docker ps (propably web20_db_1) +mysql -u root -p # then enter root password which is in docker-compose.yml + +``` +```SQL +CREATE USER 'sik'@'%' IDENTIFIED BY 'password123'; +CREATE DATABASE sik DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; +GRANT ALL PRIVILEGES ON sik.* TO 'sik'@'%'; +``` +Then ctrl-d away from docker bash shell and shutdown db image with ctrl-c + +### Configuring web-image + +1. Fix your settings.py to use 'db' as host and correct user and password (configured above) +2. run following commands +```BASH + +sudo docker-compose run web python manage.py migrate +sudo docker-compose run web python manage.py makemigrations infoscreen members +sudo docker-compose run web python manage.py migrate +sudo docker-compose run web python manage.py createsuperuser +``` + +### starting dev unit + +``` +sudo docker-compose up +``` + +now you should have dev environment running on localhost:8000 + +NOTE: as your working dir (web2.0) is mounted by images changes will be reflected immediately. no rebuilding needed. migrations and makemigrations must still be run separately though. see examples above + + +## Installation to python virtual env ### Create a virtual environment for python