add docker installation guide to readme.md
This commit is contained in:
@@ -1,6 +1,55 @@
|
|||||||
# SIKWEB 2.0
|
# 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 <image_name> 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
|
### Create a virtual environment for python
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user