first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 mabe1489
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
## Installation
|
||||||
|
```ini
|
||||||
|
|
||||||
|
git clone https://github.com/mabe1489/compose-autostart.git
|
||||||
|
cd compose-autostart/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
### Flags
|
||||||
|
`-p` Path to the docker-compose.yml
|
||||||
|
`-c` Compose Project name
|
||||||
|
|
||||||
|
### Preconfiguration
|
||||||
|
After that installing a cronjob with:
|
||||||
|
```crontab
|
||||||
|
crontab -e
|
||||||
|
*/10 * * * * bash YourFolder/autostart.sh -p -c
|
||||||
|
```
|
||||||
|
### Update Docker Compose projects
|
||||||
|
Use
|
||||||
|
```file
|
||||||
|
compose-autostart/update_container.sh
|
||||||
|
```
|
||||||
|
with the the flags above.
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Environment variables with flags
|
||||||
|
DOCKER_PATH="${DOCKER_PATH:-/}"
|
||||||
|
PROJECT_NAME="${PROJECT_NAME:-npm}"
|
||||||
|
|
||||||
|
while getopts ":p:c:" opt; do
|
||||||
|
case $opt in
|
||||||
|
p) DOCKER_PATH="$OPTARG";;
|
||||||
|
c) PROJECT_NAME="$OPTARG";;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
|
cd "$DOCKER_PATH"
|
||||||
|
docker compose -p "$PROJECT_NAME" up -d
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
cat > /etc/docker/daemon.json <<'EOF'
|
||||||
|
{
|
||||||
|
"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
mkdir -p /etc/systemd/system/docker.service.d
|
||||||
|
cat > /etc/systemd/system/docker.service.d/override.conf <<'EOF'
|
||||||
|
[Service]
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=/usr/bin/dockerd
|
||||||
|
EOF
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart docker.service
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Environment variables with flags
|
||||||
|
DOCKER_PATH="${DOCKER_PATH:-}"
|
||||||
|
PROJECT_NAME="${PROJECT_NAME:-npm}"
|
||||||
|
|
||||||
|
while getopts ":p:c:" opt; do
|
||||||
|
case $opt in
|
||||||
|
p) DOCKER_PATH="$OPTARG";;
|
||||||
|
c) PROJECT_NAME="$OPTARG";;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
|
cd "$DOCKER_PATH"
|
||||||
|
docker compose -p "$PROJECT_NAME" pull
|
||||||
|
docker compose -p "$PROJECT_NAME" up --force-recreate --build -d
|
||||||
|
docker image prune -f
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
> [!IMPORTANT]
|
||||||
|
> It is only for Hetzners RRSets in the cloud console
|
||||||
|
|
||||||
|
# Hetzner DynDNS (A-Records) based on a bash script.
|
||||||
|
The script uses the cloud API to update a RRSet. You can use different flags for different records (subdomains)
|
||||||
|
This script uses the zoneID not the zone name.
|
||||||
|
It´s easy to use and setting up the script should function by following the Readme.
|
||||||
|
|
||||||
|
|
||||||
|
Requirements: `curl`, `git`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
```ini
|
||||||
|
git clone https://github.com/mabe1489/Hetzner-DynDNS-RRSet.git
|
||||||
|
cd Hetzner-DynDNS-RRSet/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Script Configuration
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> You need your ZoneID and your API-Token
|
||||||
|
|
||||||
|
You need an API Token: Your project > security > API-Tokens > Create one with read and write access.
|
||||||
|
|
||||||
|
You need your zoneID: run the zoneID script: `bash ./zoneID.sh -t YOUR_API-TOKEN`.
|
||||||
|
|
||||||
|
Now save your zoneID in the ddns.sh in ZONE_ID and also enter your API-Token in API-TOKEN.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> You have to use the zoneID wich is the highest result of the `zoneID.sh`
|
||||||
|
|
||||||
|
With the flag `-n` you can enter your record name.
|
||||||
|
|
||||||
|
### Preconfiguration
|
||||||
|
After that installing a cronjob with:
|
||||||
|
```crontab
|
||||||
|
crontab -e
|
||||||
|
*/10 * * * * bash YourFolder/ddns.sh -n Your-Record-Name
|
||||||
|
```
|
||||||
|
|
||||||
|
## Thank you
|
||||||
|
Have fun and send issues in the issue tab (That would be really nice)
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# ddns.sh
|
||||||
|
# Updates a Hetzner Cloud zone rrset A record to the current public IPv4.
|
||||||
|
#
|
||||||
|
# Usage: ./ddns.sh [-t API_TOKEN] [-z ZONE_ID] [-n RRSET_NAME]
|
||||||
|
# -t: Hetzner API token
|
||||||
|
# -z: Zone ID
|
||||||
|
# -n: RRSET name
|
||||||
|
|
||||||
|
# Default values
|
||||||
|
API_TOKEN="Your-API-Token"
|
||||||
|
ZONE_ID="zone_ID-For_Information_look_at_the_readme"
|
||||||
|
RRSET_NAME="Record-name"
|
||||||
|
|
||||||
|
# Parse command line arguments
|
||||||
|
while getopts ":t:z:n:" opt; do
|
||||||
|
case $opt in
|
||||||
|
t) API_TOKEN="$OPTARG";;
|
||||||
|
z) ZONE_ID="$OPTARG";;
|
||||||
|
n) RRSET_NAME="$OPTARG";;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Validate required parameters
|
||||||
|
if [ "$API_TOKEN" = "Ihr-API-Token-hier" ]; then
|
||||||
|
echo "Error: API Token is required. Use -t option or set it in the script." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get current public IPv4 (trim newline)
|
||||||
|
CURRENT_IPV4=$(curl -fsS https://ipv4.icanhazip.com | tr -d '\n')
|
||||||
|
|
||||||
|
if [ -z "$CURRENT_IPV4" ]; then
|
||||||
|
echo "Failed to determine public IPv4. Exiting." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
JSON_PAYLOAD=$(cat <<EOF
|
||||||
|
{"records":[{"value":"$CURRENT_IPV4","comment":""}]}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
API_URL="https://api.hetzner.cloud/v1/zones/${ZONE_ID}/rrsets/${RRSET_NAME}/A/actions/set_records"
|
||||||
|
|
||||||
|
echo "Updating A record '$RRSET_NAME' in zone id $ZONE_ID to $CURRENT_IPV4"
|
||||||
|
|
||||||
|
curl -fsS -X POST \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$JSON_PAYLOAD" \
|
||||||
|
"$API_URL" \
|
||||||
|
|| { echo "API request failed" >&2; exit 2; }
|
||||||
|
|
||||||
|
echo "Update request sent."
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
# -t: Hetzner API token
|
||||||
|
API_TOKEN="Your-API-Token"
|
||||||
|
|
||||||
|
while getopts ":t:z:n:" opt; do
|
||||||
|
case $opt in
|
||||||
|
t) API_TOKEN="$OPTARG";;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
curl \
|
||||||
|
-H "Authorization: Bearer $API_TOKEN" \
|
||||||
|
"https://api.hetzner.cloud/v1/zones/"
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
apt install -fy ./rustdesk.deb
|
||||||
+1002
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Environment variables with flags
|
||||||
|
NODE_EXPORTER="${NODE_EXPORTER:-0}"
|
||||||
|
|
||||||
|
while getopts ":e:" opt; do
|
||||||
|
case $opt in
|
||||||
|
e) NODE_EXPORTER="1";;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
apt update
|
||||||
|
apt upgrade -y
|
||||||
|
|
||||||
|
# Docker installation
|
||||||
|
# Add Docker's official GPG key:
|
||||||
|
apt install ca-certificates curl -y
|
||||||
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
|
chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
|
|
||||||
|
# Add the repository to Apt sources:
|
||||||
|
tee /etc/apt/sources.list.d/docker.sources <<EOF
|
||||||
|
Types: deb
|
||||||
|
URIs: https://download.docker.com/linux/debian
|
||||||
|
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
|
||||||
|
Components: stable
|
||||||
|
Signed-By: /etc/apt/keyrings/docker.asc
|
||||||
|
EOF
|
||||||
|
|
||||||
|
apt update
|
||||||
|
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
||||||
|
systemctl start docker
|
||||||
|
docker run hello-world
|
||||||
|
|
||||||
|
# New Proxymanager folder
|
||||||
|
|
||||||
|
cp -r proxymanager /opt/
|
||||||
|
|
||||||
|
# other programs
|
||||||
|
|
||||||
|
apt install jq -y
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$NODE_EXPORTER" == "1" ]
|
||||||
|
then
|
||||||
|
bash prometheus-nodeExporter.sh
|
||||||
|
fi
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd ~/node_exporter-1.10.2.linux-amd64
|
||||||
|
./node_exporter
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cp prometheus-export.sh ~/prometheus-export.sh
|
||||||
|
cd ~
|
||||||
|
wget https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-amd64.tar.gz
|
||||||
|
tar xvfz node_exporter-1.10.2.linux-amd64.tar.gz
|
||||||
|
mv prometheus-export.sh node_exporter-1.10.2.linux-amd64/prometheus-export.sh
|
||||||
|
rm node_exporter-1.10.2.linux-amd64.tar.gz
|
||||||
|
cd node_exporter-1.10.2.linux-amd64
|
||||||
|
(crontab -l 2>/dev/null; echo "*/5 * * * * ~/prometheus-export.sh") | crontab -
|
||||||
|
./node_exporter
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
PG_PASS = SuperSecretPassword
|
||||||
|
PG_USER = npm
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: 'jc21/nginx-proxy-manager:latest'
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: npm
|
||||||
|
ports:
|
||||||
|
# These ports are in format <host-port>:<container-port>
|
||||||
|
- '80:80' # Public HTTP Port
|
||||||
|
- '443:443' # Public HTTPS Port
|
||||||
|
- '81:81' # Admin Web Port
|
||||||
|
# Add any other Stream port you want to expose
|
||||||
|
# - '21:21' # FTP
|
||||||
|
environment:
|
||||||
|
TZ: "Europe/Berlin"
|
||||||
|
# Postgres parameters:
|
||||||
|
DB_POSTGRES_HOST: 'db'
|
||||||
|
DB_POSTGRES_PORT: '5432'
|
||||||
|
DB_POSTGRES_USER: ${PG_USER:-npm}
|
||||||
|
DB_POSTGRES_PASSWORD: ${PG_PASS}
|
||||||
|
DB_POSTGRES_NAME: 'npm'
|
||||||
|
# Uncomment this if IPv6 is not enabled on your host
|
||||||
|
# DISABLE_IPV6: 'true'
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./letsencrypt:/etc/letsencrypt
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:17
|
||||||
|
container_name: npm-db
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${PG_USER:-npm}
|
||||||
|
POSTGRES_PASSWORD: ${PG_PASS}
|
||||||
|
POSTGRES_DB: 'npm'
|
||||||
|
volumes:
|
||||||
|
- ./postgresql:/var/lib/postgresql
|
||||||
Reference in New Issue
Block a user