Guides

Traefik Docker

March 12, 2024 - Reading time: 2 minutes

Making directories

I'll be saving my data in ~/docker in this example

  1. Open terminal and cd docker (mkdir docker if you don't have it)
  2. mkdir traefik and cd traefik
    This will be where i save my traefik
  3. nano docker-compose.yml  [Template]
  4. CTRL + X, y and Enter # For the basicauth.users label

Replace admin:123 with a secure login
echo $(htpasswd -nb "admin" "123") | sed -e s/\\$/\\$\\$/g
Use the result from this command


Making a few more files we will need

  1. touch config.yml
  2. touch acme.json
  3. nano traefik.yml
  4. [Template] add your cloudflare email. CTRL + X, y and Enter
  5. mkdir logs

Almost done

  1. sudo docker network create proxy
  2. sudo docker compose up -d
  3. sudo docker compose logs -f (if you want to see logs)
    Now just head on over to your domain and you should see the traefik gui
Read more
Guides

DDNS script for cloudflare

March 12, 2024 - Reading time: 3 minutes

Make an A record pointing to 8.8.8.8 with proxy off

Global Key here
https://dash.cloudflare.com/profile/api-tokens

curl -s -X GET "https://api.cloudflare.com/client/v4/zones/Zone ID/dns_records?name=domain.tld" -H "X-Auth-Email: email@example.com" -H "X-Auth-Key: Global Key" -H "Content-Type: application/json"

Your result should start with something like below, let's call this THE ID
{"result":{"id":"he832434238hb327g" Put this in THE ID in the (and obviously fill in the other information we gathered)


Scroll down on the "Overview" tab and you will find your Zone ID

https://dash.cloudflare.com/somethingsomething/domain.tld


Now fill your Email, Global key, Zone ID & THE ID

curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/Zone ID/dns_records/THE ID" -H "X-Auth-Email:email@example.com" -H "X-Auth-Key:Global Key" -H "Content-Type: application/json" --data "{\"id\":\"Zone ID\",\"type\":\"A\",\"name\":\"domain.tld\",\"content\":\"$(curl https://ifconfig.co)\",\"proxied\":true}"

After running this command in your terminal you should see the A record has changed to your ip with the proxy enabled.


Marking the script run run automatically

1. mkdir /path/to/ddns.sh

2. chmod 700 /path/to/ddns.sh

3. Put the command we just made in here

nano /path/to/ddns.sh

4. crontab -e

5. */5 * * * * /path/to/ddns.sh >/dev/null 2>&1


Read more