Browse Source

Update README.md

master
Tai 2 months ago committed by GitHub
parent
commit
21e68fd1a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 35
      initial ubuntu setup/README.md

35
initial ubuntu setup/README.md

@ -14,8 +14,8 @@ If you are an **experienced user** and want to blaze thru steps 1 and 8. You can @@ -14,8 +14,8 @@ If you are an **experienced user** and want to blaze thru steps 1 and 8. You can
**The references I used to write the rest of these notes are bulleted below:**
* Initial Server Setup: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04
* How to install Docker: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
* How to install docker-compose: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04
* How to install Caddy: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04
* How to install docker compose: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker compose-on-ubuntu-20-04
* How to install Caddy: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker compose-on-ubuntu-20-04
**Now on to the Main Installation Guide**
@ -105,13 +105,13 @@ id -nG @@ -105,13 +105,13 @@ id -nG
```
This should return: **sammy** sudo docker
### 8. Install Docker-Compose
### 8. Install docker compose
```
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker compose
sudo chmod +x /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker compose
docker-compose --version
docker compose --version
```
### 9. Create a docker network called caddy_net
@ -141,7 +141,7 @@ It allows you to host multiple applications based on the same or different hostn @@ -141,7 +141,7 @@ It allows you to host multiple applications based on the same or different hostn
├── data/
├── .env
├── Caddyfile
└── docker-compose.yml
└── docker compose.yml
```
To achieve this a part of this folder structure do the following below.
```
@ -153,22 +153,21 @@ cd caddy @@ -153,22 +153,21 @@ cd caddy
```
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
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 docker compose.yml in the same directory.
**.env**
```
MY_DOMAIN=example.com
```
**Ctrl+O** to save file.
#### Creating docker-compose.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)
**docker-compose.yml**
#### Creating docker compose.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)
**docker compose.yml**
```
version: "3.7"
services:
caddy:
@ -230,9 +229,9 @@ For now your Caddyfile can be the same as the example above if you plan on deplo @@ -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
Then do
```
docker-compose up -d
docker compose 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 `docker compose down`.
### 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.
@ -242,13 +241,13 @@ The general flow for adding new application like wordpress for example is: @@ -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)
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`
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 docker compose.yml
5. Use nano to add the app specific blocks to your Caddyfile in ` /home/sammy/docker/caddy/Caddyfile` and save.
6. Reload caddy `docker exec -w /etc/caddy caddy caddy reload`
7. Change back to your app specific folder ` /home/sammy/docker/newapp`
8. `docker-compose up -d` to start the new application
8. `docker compose up -d` to start the new application
9. Test your app by visiting yourappsubdomain.yourwebsite.com
That's it! As you do this more often, the more you'll appreciate how fast it is to deploy applications with docker and docker-compose with caddy v2!
That's it! As you do this more often, the more you'll appreciate how fast it is to deploy applications with docker and docker compose with caddy v2!
Refer to the readme at: https://github.com/StarWhiz/docker_deployment_notes for command references

Loading…
Cancel
Save