Files
onedev-deployment/README.md
2026-03-25 01:11:27 +08:00

37 lines
1.7 KiB
Markdown

# OneDev Auto-Deployer
A production-ready Docker Compose setup for [OneDev](https://onedev.io/), utilizing Docker volumes for data management and Caddy for automatic SSL and reverse proxying.
## Prerequisites
- Docker & Docker Compose installed.
- Ports `80`, `443`, and `6611` open on your firewall.
- Your domain's DNS A-Record pointing to your server's IP address.
## Deployment
1. Clone this repository and enter the directory.
2. Run the initial setup:
```bash
chmod +x run.sh
./run.sh
```
3. The script will create a `.env` file. Edit this file and set your `DOMAIN` and `EMAIL`.
4. Run `./run.sh` again to start the services.
## SSL & HTTP Configuration
This deployment handles routing automatically via Caddy:
1. **Auto SSL (Let's Encrypt):** If you provide an `EMAIL` in the `.env` file, Caddy will automatically fetch and renew an SSL certificate.
2. **Custom SSL:** If you place `cert.pem` and `key.pem` inside the `certs/` folder, Caddy will use those instead.
3. **Plain HTTP:** If you leave `EMAIL` completely blank in the `.env` file and provide no custom certificates, Caddy will serve the site over plain HTTP on port 80.
## Custom SSL Certificates (Optional)
By default, the script will automatically obtain a Let's Encrypt certificate for your domain.
If you want to use your own certificates:
1. Place your certificate and key inside the `certs/` folder.
2. Rename them to exactly `cert.pem` and `key.pem`.
3. Run `./run.sh`. The script will detect them and use them instead of Let's Encrypt.
## Managing Data
Data is stored securely in Docker managed volumes. To back up your OneDev data, you need to back up the `onedev_data` docker volume.