==============================OLD_README========================
Log in as user you just created ssh user@your-server
from local or su - yourusername
from root access
## Install Docker & Docker-compose
sudo apt update && sudo apt install apt-transport-https ca-certificates curl software-properties-common -y && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" && apt-cache policy docker-ce && sudo apt install docker-ce -y && sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
#Check if docker & docker-compose is installed
sudo docker --version && docker-compose --version
Install Portainer CE & Caddy-server & Wireguard Server
Log in as user you just created ssh user@your-server
Create a Caddyfile & Portainer data
sudo docker volume create --name=caddy_data # Create caddy data
sudo mkdir ~/initial-server
sudo mkdir ~/initial-server/caddy
sudo mkdir ~/initial-server/portainer
sudo mkdir ~/initial-server/wg
sudo nano ~/initial-server/caddy/Caddyfile
Caddyfile example:
portainer.your-domain.com {
reverse_proxy portainer:9000 # Reverse proxy to Portainer container example
}
1 script to Install Portainer CE & Caddy-server & Wireguard Server
Download docker-compose file and Edit Wireguard server password
sudo wget https://raw.githubusercontent.com/hophamlam/initial-server/main/docker-compose.yml -P ~/portainer-caddy-wg/ && sudo nano ~/portainer-caddy-wg/docker-compose.yml
Now we go
sudo docker compose -f ~/initial-server/docker-compose.yml up -d
Whenever you want to update new record in Caddyfile:
sudo nano ~/initial-server/caddy/Caddyfile
## example Caddyfile
portainer.your-domain.com {
reverse_proxy portainer:9000 ## Reverse proxy to Portainer container example
}
wg.your-domain.com {
reverse_proxy wg-easy:51821 ## Update new domain for wireguard-server-webui
}
⚠️IMPORTANT:
- Join the container/app with caddy container network
- Point domain to host
- Ping domain to test
- Restart caddy container by log in to Portainer at
http://your-server-ip:9000
and restart Caddy container
Or
sudo docker restart caddy
sudo docker kill portainer
sudo docker kill caddy
sudo docker rm porainter
sudo docker rm caddy
sudo docker ps -a
#check if nothing display is good
In case you need to install Portainer Agent
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest
sudo docker compose -f ~/initial-server/docker-compose.yml down && sudo docker compose -f ~/initial-server/docker-compose.yml up -d