#### Wordpress with docker-scripts
##### 1. Install dependencies
1. Install docker
```
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
```
Reference: https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script
2. Install docker-scripts
```
apt install m4
git clone https://gitlab.com/docker-scripts/ds /opt/docker-scripts/ds
cd /opt/docker-scripts/ds/
make install
ds -v
ds -h
```
Reference: https://gitlab.com/docker-scripts/ds#installation
3. Install Webserver Proxy
```
ds pull wsproxy
ds init wsproxy @wsproxy
cd /var/ds/wsproxy/
vim settings.sh
ds make
```
Reference: https://gitlab.com/docker-scripts/wsproxy#installation
4. Install MariaDB
```
ds pull mariadb
ds init mariadb @mariadb
cd /var/ds/mariadb/
vim settings.sh
ds make
```
Reference: https://gitlab.com/docker-scripts/mariadb#installation
##### 2. Install Wordpress sites
1. Install a wordpress container
```
ds pull wordpress
ds init wordpress @wordpress1
cd /var/ds/wordpress1/
vim settings.sh
ds make
```
Reference: https://gitlab.com/docker-scripts/wordpress#installation
2. Install a site
```
cd /var/ds/wordpress1/
ds site
ds site init site1.wp.fs.al
ls
ls site1.wp.fs.al
ls apache2/sites-enabled/
cat apache2/sites-enabled/site1.wp.fs.al.conf
ls ../wsproxy/sites-enabled/
cat ../wsproxy/sites-enabled/site1.wp.fs.al.conf
```
```
vim site1.wp.fs.al/settings.sh
ds site install site1.wp.fs.al
ls site1.wp.fs.al/
```
Try in browser https://site1.wp.fs.al and login as admin.
Reference: https://gitlab.com/docker-scripts/wordpress#manage-a-website
3. Install another site
```
cd /var/ds/wordpress1/
ds site init site2.wp.fs.al
ls
ls site2.wp.fs.al
ls apache2/sites-enabled/
ls ../wsproxy/sites-enabled/
vim site2.wp.fs.al/settings.sh
ds site install site2.wp.fs.al
ls site2.wp.fs.al/
```
Try in browser https://site2.wp.fs.al
4. Install a second container
```
ds init wordpress @wordpress2
cd /var/ds/wordpress2/
vim settings.sh
ds make
```
5. Install a site on the second container
```
cd /var/ds/wordpress2/
ds site init site3.wp.fs.al
vim site3.wp.fs.al/settings.sh
ds site install site3.wp.fs.al
ls site3.wp.fs.al/
```
Try in browser https://site3.wp.fs.al
6. Clone and delete a site
```
cd /var/ds/wordpress2/
ds site clone
ds site clone site3.wp.fs.al site4.wp.fs.al
```
Try in browser https://site4.wp.fs.al
```
ds site del
ds site del site4.wp.fs.al
```
7. Backup and restore a site
```
cd /var/ds/wordpress2/
ds backup
ds backup site3.wp.fs.al
ls -lh backup/
```
```
ds site del site3.wp.fs.al
```
Try in browser https://site3.wp.fs.al
```
ds site init site3.wp.fs.al
ls site3.wp.fs.al/
ds restore
ds restore site3.wp.fs.al backup/wordpress-site3.wp.fs.al-2020-07-29.tgz
```
Try in browser https://site3.wp.fs.al
3. Using wp-cli
```
cd /var/ds/wordpress2/
ds wp
ds wp site3.wp.fs.al
ds wp site3.wp.fs.al option
ds wp site3.wp.fs.al option list
ds wp site3.wp.fs.al option get siteurl
ds wp site3.wp.fs.al option get home
```
3. Working inside the container
```
ds shell
ls
cd site3.wp.fs.al
wp
wp option get siteurl
wp option get home
```