This repo contains various scripts and tweaks for Portainer and other relevant containers.

---

# Activate SSL via NPM (Nginx Proxy Manager) for Portainer

1. Set up NPM as a container and generate SSL certificates.

2. Create a script to copy the certificates to the host, ensuring Portainer loads them on reboot.
   - Copy script: [copycert.sh](./portainer-ssl-with-npm/copycert.sh)
   - Ensure the script is executable: `chmod +x copycert.sh`

3. Set up a crontab to automate the copy process.
   - Crontab setup: [crontab.md](./portainer-ssl-with-npm/crontab.md)

4. Start/restart Portainer with the SSL certificates.
   - `--replace` swaps the container with the new settings — nothing is deleted.
```
sudo podman run -d -p 8000:8000 -p 9443:9443 --replace --name portainer --restart=always --privileged -v /run/podman/podman.sock:/var/run/docker.sock -v portainer_data:/data -v /etc/ssl/certs/portainer/:/certs portainer/portainer-ce:lts --tlscert /certs/fullchain.pem --tlskey /certs/privkey.pem
```

---

# Expose Gitea via NPM (Nginx Proxy Manager)

1. Create a shared network so NPM and Gitea can communicate internally.

2. Add the `proxy` network to both stacks in Portainer.
   - NPM compose — add `proxy` network to the `app` service.
   - Gitea compose — add `proxy` network to the `server` service (not `db`).

3. Set `ROOT_URL` in Gitea's `app.ini` to use HTTPS.
```ini
   ROOT_URL = https://git.example.com/
```
4. Configure NPM Proxy Host.
   - Forward Hostname/IP: `gitea-stack`
   - Forward Port: `3000`
   - Websockets Support: enabled
   - SSL: Force SSL enabled

# Expose IT Tools via NPM (Nginx Proxy Manager)

1. Add the `proxy` network to the IT Tools stack.
   - IT Tools compose — add `proxy` network to the `it-tools` service.
2. Configure NPM Proxy Host.
   - Forward Hostname/IP: `it-tools-stack`
   - Forward Port: `80` (container port, not host port)
   - SSL: Force SSL enabled

> **Note:** Always use the container's internal port in NPM, not the host port. NPM communicates directly with the container via the shared network.