No description
- Shell 100%
Initial set up of the system as well as including Forgejo as the first app (outside of Caddy). The setup.sh handles all configurations through a user interactive cli menu including setting up Forgejo SMTP. Updates can be applied by rerunning the setup.sh which will check only for new services that aren't currently running. Reviewed-on: https://git.marquel.xyz/msrogers2015/diy-cloud/pulls/1 Co-authored-by: Marquel Rogers <rogers@marquel.xyz> Co-committed-by: Marquel Rogers <rogers@marquel.xyz> |
||
|---|---|---|
| scripts | ||
| services | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| setup.sh | ||
diy-cloud
A self-hosted VPS bootstrap repo. Clone it, run the setup script, and get your services up and running with a single command.
Requirements
- A VPS running Ubuntu 24.04 LTS
- A domain name with DNS managed via a provider (e.g. Porkbun, Cloudflare)
- Ports 80, 443, and 22 open on your VPS firewall
DNS Setup
Before running the setup script, create an A record for each service you plan to enable, pointing to your VPS IP address.
| Type | Host/Value | Resolve/Address | |
|---|---|---|---|
| What you need | A | Service Name | Your VPS IPv4 address |
| Example | A | forgejo.yourdomain.com |
127.0.0.1 |
Installation
1. Clone the repo
sudo git clone https://your-forgejo-url/you/diy-cloud.git /opt/vps
cd /opt/vps
2. Make the setup script executable
chmod +x setup.sh
3. Run the setup script
./setup.sh
The script will:
- Check for Docker and offer to install it if missing
- Create required data directories
- Create the
vps-netDocker network - Prompt for your domain and email (used for Let's Encrypt SSL)
- Ask which services you want to enable and prompt for their configuration
- Show a summary before starting anything
- Start all selected services
Updating
To apply updates to the repo without affecting your running services or data:
cd /opt/vps
git pull
./setup.sh
Your data folders and .env files are gitignored and will never be touched by a git pull.
Services
Caddy
Reverse proxy that handles all incoming traffic and automatic SSL certificates via Let's Encrypt. Always starts — all other services depend on it.
Forgejo
Self-hosted Git service. Stores repository metadata in a Postgres database and raw Git data on disk.
- Web UI:
https://forgejo.yourdomain.com - SSH:
ssh -p 2222 git@yourdomain.com
Useful Commands
# View logs for a service
docker compose -f services/<service>/docker-compose.yaml logs -f
# Stop a service
docker compose -f services/<service>/docker-compose.yaml down
# Restart a service
docker compose -f services/<service>/docker-compose.yaml restart
# Check running containers
docker ps
File Structure
diy-cloud/
├── setup.sh # Entry point
├── scripts/
│ ├── vps_config.sh # Docker install, network, directories
│ ├── caddy.sh # Caddy prompts and Caddyfile generation
│ └── forgejo.sh # Forgejo prompts and .env generation
├── services/
│ ├── caddy/
│ │ ├── data/ # Caddy TLS data (gitignored)
│ │ ├── config/ # Caddy config cache (gitignored)
│ │ ├── Caddyfile # Generated by setup.sh (gitignored)
│ │ └── docker-compose.yaml
│ └── forgejo/
│ ├── data/ # Forgejo and Postgres data (gitignored)
│ ├── .env # Generated by setup.sh (gitignored)
│ ├── .env.example # Template committed to repo
│ └── docker-compose.yaml
├── .gitignore
├── LICENSE
└── README.md