Initial commit. Tilføjet filer fra Codeberg
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
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.
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
it-tools:
|
||||||
|
image: 'corentinth/it-tools:latest'
|
||||||
|
ports:
|
||||||
|
- '8080:80'
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: it-tools-stack
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!bin/bash
|
||||||
|
#Assuming the NPM conf is at $baselocation
|
||||||
|
#This script can be placed at /etc/opt/scripts/
|
||||||
|
umask 077
|
||||||
|
baselocation="/etc/opt/docker_conf/nginxproxymanager-stack/data/letsencrypt/live/"
|
||||||
|
|
||||||
|
latestnpmfolder=$(ls -t "$baselocation"|head -n 1)
|
||||||
|
certlocation=$baselocation$latestnpmfolder/
|
||||||
|
pushd $certlocation
|
||||||
|
cp -L -rf fullchain.pem /etc/ssl/certs/portainer/
|
||||||
|
cp -L -rf privkey.pem /etc/ssl/certs/portainer/
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Crontab script as follows
|
||||||
|
```
|
||||||
|
0 * * * * sh /etc/opt/scripts/copycert.sh >/dev/null 2>&1
|
||||||
|
@reboot sh /etc/opt/scripts/copycert.sh >/dev/null 2>&1
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user