# Biuro websites

## Information 
- Project repository [dev.biuro](http://git.biuro.lt/biuro/dev.biuro)
- Created from [wordpress-nginx-docker](https://github.com/mjstealey/wordpress-nginx-docker)
- SSL Certificates are created with [SSL For Free](https://www.sslforfree.com/?domains=biuro.lt%20www.biuro.lt%20dev.biuro.lt%20staging.biuro.lt%20biuro.lv%20www.biuro.lv%20dev.biuro.lv%20staging.biuro.lv%20biuro.ee%20www.biuro.ee%20dev.biuro.ee%20staging.biuro.ee)

## Installation 
- Install [Docker Desktop](https://www.docker.com/products/docker-desktop) on your machine
	- Creating new User on my machine helped me with sharing C drive problem (https://tomssl.com/2018/01/11/sharing-your-c-drive-with-docker-for-windows-when-using-azure-active-directory-azuread-aad/) 
- Clone [dev.biuro](http://git.biuro.lt/biuro/dev.biuro) repository
- in Windows PowerShell run `docker-compose up -d` 
- `docker ps` command should output existing docker containers (nginx, mysql, wordpress)
- restore DB as written in *DB restore* section
- check if dev.biuro.lt, dev.biuro.lv, dev.biuro.ee (it should be set in hosts to 127.0.0.1)

## User
- biuro
- laikinas2587 
- info@biuro.eu

### Wordpress
- Regions created using [Wordpress Network](https://codex.wordpress.org/Create_A_Network)



#### DB backup
- `C:\web\dev.biuro> docker exec -i mysql mysqldump -u root -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress > docker/mariadb/db_001.sql`

#### DB restore
- `C:\web\dev.biuro> cat docker/mariadb/db_001.sql | docker exec -i mysql /usr/bin/mysql -u root -pIiIjnsLi2wR9i1kWVbVpUAzP wordpress`

#### DB preview
- `docker exec -it mysql bash`
- `mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8`
- `use wordpress;`
- `show tables;`

- `use information_schema;`
- `select * from SCHEMATA;`


https://stackoverflow.com/questions/43880026/import-data-sql-mysql-docker-container

docker exec -i mysql mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress < docker/mariadb/db_001.sql

docker exec -i mysql mysqldump -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress > docker/mariadb/db_001.sql

mysqldump -u root -pIiIjnsLi2wR9i1kWVbVpUAzP wordpress -r utf8.dump

mysqldump -u root -pIiIjnsLi2wR9i1kWVbVpUAzP wordpress -r utf8.dump



docker-compose exec db mysql -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP mysqldump wordpress > docker/mariadb/db_003.sql




docker exec mysql /usr/bin/mysqldump -uroot -pIiIjnsLi2wR9i1kWVbVpUAzP --default-character-set=utf8 wordpress > docker/mariadb/db_004.sql


## Plugins

## Known issues (Windows 10)
### Error
Cannot start service mysql: b"error while creating mount source path '/host_mnt/c/web/dev.biuro/var/mariadb': mkdir /host_mnt/c: file exists"

### Solution
Restart docker

## Other
- docker-compose up -d
- docker-compose start
- docker-compose stop

- docker-compose rm -fv

- docker ps

- docker update --restart=no mysql
- docker update --restart=no nginx
- docker update --restart=no wordpress

- docker system prune --all

- docker stop mysql
- docker stop nginx
- docker stop wordpress

- docker restart mysql
- docker restart nginx
- docker restart wordpress

- https://docs.google.com/document/d/1FiwVoiLvGGmi9V-HPBgJ3gsh3wGswt27csgvfdTU24w/edit?usp=sharing
- https://docs.google.com/spreadsheets/d/1ggnqKuGxFFkLgI6NDZq4PXpRY_whdHX0kjZj7pCP_fk/edit?ts=5b5eaa62#gid=0
- https://docs.google.com/spreadsheets/d/1dXP0dh_v2sFajrcwR2_9HONMadCdZQW4Y2dVXvhxG3E/edit?ts=5b5eaa6b#gid=748245000

