@ -141,7 +141,7 @@ It allows you to host multiple applications based on the same or different hostn
├── data/
├── data/
├── .env
├── .env
├── Caddyfile
├── Caddyfile
└── docker-compose.yml
└── dockercompose.yml
```
```
To achieve this a part of this folder structure do the following below.
To achieve this a part of this folder structure do the following below.
```
```
@ -153,22 +153,21 @@ cd caddy
```
```
So now you're inside the caddy folder.
So now you're inside the caddy folder.
At minimum you will need a **.env**, **Caddyfile** and **docker-compose.yml**. the config/ and data/ folders are automatically generated by docker-compose later.
At minimum you will need a **.env**, **Caddyfile** and **docker compose.yml**. the config/ and data/ folders are automatically generated by docker compose later.
#### Creating .env
#### Creating .env
Do this with `nano .env` and add the following lines in the .env file. Do not use subdomain. Just use yourrootdomain.com, in this example I'm using example.com
Do this with `nano .env` and add the following lines in the .env file. Do not use subdomain. Just use yourrootdomain.com, in this example I'm using example.com
The purpose of the .env file is to substitute variables in your docker-compose.yml in the same directory.
The purpose of the .env file is to substitute variables in your dockercompose.yml in the same directory.
**.env**
**.env**
```
```
MY_DOMAIN=example.com
MY_DOMAIN=example.com
```
```
**Ctrl+O** to save file.
**Ctrl+O** to save file.
#### Creating docker-compose.yml
#### Creating dockercompose.yml
A small explanation about this can be found [here](https://github.com/StarWhiz/docker_deployment_notes#commonly-added-lines-added-to-app-specific-docker-composeyml-files)
A small explanation about this can be found [here](https://github.com/StarWhiz/docker_deployment_notes#commonly-added-lines-added-to-app-specific-dockercomposeyml-files)
**docker-compose.yml**
**dockercompose.yml**
```
```
version: "3.7"
services:
services:
caddy:
caddy:
@ -230,9 +229,9 @@ For now your Caddyfile can be the same as the example above if you plan on deplo
Make sure you're in /home/sammy/docker/caddy
Make sure you're in /home/sammy/docker/caddy
Then do
Then do
```
```
docker-compose up -d
dockercompose up -d
```
```
to start caddy. To bring it down you can do `docker-compose down`.
to start caddy. To bring it down you can do `dockercompose down`.
### Time to deploy Applications
### Time to deploy Applications
Congrats you are now ready to deploy applications. The other applications will be deployed the same way you just deployed Caddy! I recommend you deploy [wordpress](https://github.com/StarWhiz/docker_deployment_notes/tree/master/wordpress) first if you are new to this.
Congrats you are now ready to deploy applications. The other applications will be deployed the same way you just deployed Caddy! I recommend you deploy [wordpress](https://github.com/StarWhiz/docker_deployment_notes/tree/master/wordpress) first if you are new to this.
@ -242,13 +241,13 @@ The general flow for adding new application like wordpress for example is:
1. Find an application specific [guide](https://github.com/StarWhiz/docker_deployment_notes#application-specific-deployment-guides)
1. Find an application specific [guide](https://github.com/StarWhiz/docker_deployment_notes#application-specific-deployment-guides)
2. Make a new app specific folder in `/home/sammy/docker/` with `mkdir newapp`
2. Make a new app specific folder in `/home/sammy/docker/` with `mkdir newapp`
3. Navigate inside the new app specific folder with `cd newapp`
3. Navigate inside the new app specific folder with `cd newapp`
4. Create the mimimum files as mentioned in the app specific guides, but don't worry about creating folders inside the newapp folder as they are auto generated in docker-compose.yml
4. Create the mimimum files as mentioned in the app specific guides, but don't worry about creating folders inside the newapp folder as they are auto generated in dockercompose.yml
5. Use nano to add the app specific blocks to your Caddyfile in ` /home/sammy/docker/caddy/Caddyfile` and save.
5. Use nano to add the app specific blocks to your Caddyfile in ` /home/sammy/docker/caddy/Caddyfile` and save.