initial commit
This commit is contained in:
47
_posts/2021-08-01-proxmox-docker-lxc.md
Normal file
47
_posts/2021-08-01-proxmox-docker-lxc.md
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Proxmox Docker LXC"
|
||||
description: "Installing on Proxmox a Linux Container with Docker installed and Portainer, VScode and Watchtower container configured, all with 1 line command."
|
||||
author: sthope
|
||||
categories: [ Docker, Proxmox, Portainer ]
|
||||
image: "proxmox-small-logo.png"
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Setup the LXC
|
||||
|
||||
- In the terminal of Proxmox enter:
|
||||
|
||||
```
|
||||
clear; bash -c "$(wget -qLO - https://git.sthopeless.com/sthope/proxmox_portainer/raw/branch/master/create_container.sh)"
|
||||
|
||||
```
|
||||
|
||||
It will configure and start a Debian LXC. After created you can rename the LXC and give it a static IP.
|
||||
|
||||
<br>
|
||||
# LXC configuration
|
||||
- In the LXC terminal setup root password with
|
||||
|
||||
```
|
||||
passwd
|
||||
```
|
||||
|
||||
<br>
|
||||
### Finish
|
||||
|
||||
- Portainer should be running at:
|
||||
|
||||
```http
|
||||
http://{IP}:9000
|
||||
```
|
||||
- VSCode should be running at:
|
||||
|
||||
```http
|
||||
http://{IP}:8443
|
||||
```
|
||||
- WatchTower for auto updating the containers is also installed and if you want new containers to use it simply add the label:
|
||||
|
||||
```
|
||||
com.centurylinklabs.watchtower.enable=true
|
||||
```
|
54
_posts/2021-08-02-dockerfile-and-github.md
Normal file
54
_posts/2021-08-02-dockerfile-and-github.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Dockerfile & Github"
|
||||
description: "create a simple docker container and upload it to Github"
|
||||
author: sthope
|
||||
image: "dockergithub.png"
|
||||
categories: [ Docker, Github ]
|
||||
github_create_token: 'https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-token'
|
||||
github_auth: 'https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry'
|
||||
docker_tempalte_repo: 'https://github.com/Sthopeless/dckrtmplt'
|
||||
comments: true
|
||||
---
|
||||
|
||||

|
||||
|
||||
## Setup and configure Github Token
|
||||
1. [Create Github Token]({{page.github_create_token}}) and save the token.
|
||||
2. [Authenticate]({{page.github_auth}}) with:
|
||||
(replace 'YOUR_TOKEN' with token from last step)
|
||||
```
|
||||
export CR_PAT=YOUR_TOKEN
|
||||
```
|
||||
|
||||
3. Last sign in with:
|
||||
(replace 'USERNAME' with your Github Username)
|
||||
```
|
||||
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
|
||||
```
|
||||
|
||||
## Setup container files
|
||||
|
||||
1. [Download this repository]({{page.docker_tempalte_repo}})
|
||||
2. Open terminal, go to the repo location (eg: ~/Documents/dckrtmplt) and do:
|
||||
```
|
||||
docker build -t dckrtmplt . ; \
|
||||
docker tag dckrtmplt ghcr.io/sthopeless/dckrtmplt:latest ; \
|
||||
docker push ghcr.io/sthopeless/dckrtmplt:latest
|
||||
```
|
||||
|
||||
3. Your new Package should be visible at:<br>
|
||||
[https://github.com/Sthopeless?tab=packages](https://github.com/Sthopeless?tab=packages)<br>
|
||||
(replace 'Sthopeless' with your Github Username)
|
||||
4. You can test running:
|
||||
```
|
||||
docker run -it --rm ghcr.io/sthopeless/dckrtmplt:latest
|
||||
```
|
||||
5. Set package visibility from Private to Visible, follow pictures:
|
||||
|
||||
1.<br>
|
||||
<img src="/assets/images/githubdocker/1.png" width="80%" height="80%"><br>
|
||||
2.<br>
|
||||
<img src="/assets/images/githubdocker/2.png" width="80%" height="80%"><br>
|
||||
3.<br>
|
||||
<img src="/assets/images/githubdocker/3.png" width="80%" height="80%"><br>
|
26
_posts/2021-08-03-markdown.md
Normal file
26
_posts/2021-08-03-markdown.md
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Markdown"
|
||||
description: "Markdown Sheet, work in constant progress."
|
||||
author: sthope
|
||||
image: "markdown-logo.png"
|
||||
categories: [ Markdown ]
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Markdown Examples
|
||||
|
||||
## 1. Headings
|
||||
|
||||
```
|
||||
# Heading Example
|
||||
## Heading Example
|
||||
### Heading Example
|
||||
```
|
||||
|
||||
## 2. Italic, Bold, etc..
|
||||
|
||||
Italic = `*example*` or `_example_` <br>
|
||||
Bold = `**example**` or `__example__` <br>
|
||||
Blockquote = `>` or `>>` <br>
|
||||
Horizontal Lines = `---` or `***` <br>
|
41
_posts/2021-08-05-tuya-zigbee-doorlocks.md
Normal file
41
_posts/2021-08-05-tuya-zigbee-doorlocks.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Tuya Zigbee DoorLocks"
|
||||
description: "Unlock Tuya Zigbee Doorlocks using the API"
|
||||
author: sthope
|
||||
image: "tuya-logo.png"
|
||||
categories: [ Tuya, Zigbee, Docker ]
|
||||
tyfiles: https://git.sthope.dev/sthope/Tuya_Zigbee_DoorLocks
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Docker
|
||||
|
||||
- Run Docker Container
|
||||
```
|
||||
docker run -it \
|
||||
--name tuya_doorlock \
|
||||
ghcr.io/sthopeless/tuya_doorlock:latest
|
||||
```
|
||||
|
||||
- Edit the env.py file with your details
|
||||
Exit and Save (CTRL+X and Y)
|
||||
```
|
||||
nano /home/tuya_doorlock/env.py
|
||||
```
|
||||
|
||||
- Run python file and test unlocking the DoorLock
|
||||
```
|
||||
python3 /home/tuya_doorlock/Zigbee_Doorlock.py
|
||||
```
|
||||
|
||||
- Unlock via MQTT
|
||||
```
|
||||
topic: TuyaLock/Doorlock
|
||||
payload: unlock_door
|
||||
```
|
||||
|
||||
|
||||
Raw files: [{{page.tyfiles}}]({{page.tyfiles}})
|
||||
|
||||
|
52
_posts/2021-08-06-docker-portainer.md
Normal file
52
_posts/2021-08-06-docker-portainer.md
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Docker Portainer"
|
||||
description: "Docker Portainer"
|
||||
author: sthope
|
||||
image: "portainer-small-logo.png"
|
||||
categories: [ Docker, Portainer ]
|
||||
comments: true
|
||||
---
|
||||
|
||||
# Portainer
|
||||
|
||||
1. On the terminal create folder for Portainer, eg:
|
||||
|
||||
```
|
||||
mkdir -p /docker/portainer
|
||||
```
|
||||
|
||||
2. Create and start the container:
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9000:9000 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /docker/portainer:/data \
|
||||
portainer/portainer-ce:latest
|
||||
```
|
||||
|
||||
3. Open WebUI at:
|
||||
|
||||
```http
|
||||
http://{IP}:9000
|
||||
```
|
||||
|
||||
4. Create new User
|
||||
<img src="/assets/images/docker-portainer/1.jpg" width="85%" height="85%">
|
||||
|
||||
5. Choose Docker
|
||||
<img src="/assets/images/docker-portainer/2.jpg" width="85%" height="85%">
|
||||
|
||||
6. Select your instance
|
||||
<img src="/assets/images/docker-portainer/3.jpg" width="85%" height="85%">
|
||||
|
||||
7. Open Endpoints and setup the host IP
|
||||
<img src="/assets/images/docker-portainer/4.jpg" width="85%" height="85%">
|
||||
|
||||
<img src="/assets/images/docker-portainer/5.jpg" width="85%" height="85%">
|
||||
|
||||
|
31
_posts/2021-08-07-docker-watchtower.md
Normal file
31
_posts/2021-08-07-docker-watchtower.md
Normal file
@ -0,0 +1,31 @@
|
||||
---
|
||||
layout: post
|
||||
title: "WatchTower"
|
||||
description: "Docker WatchTower"
|
||||
author: sthope
|
||||
image: "watchtower-logo.png"
|
||||
categories: [ Docker, WatchTower ]
|
||||
comments: true
|
||||
---
|
||||
|
||||
# WatchTower
|
||||
|
||||
1. Create and run Portainer Stack:
|
||||
|
||||
```yaml
|
||||
---
|
||||
version: "3.8"
|
||||
services:
|
||||
watchtower:
|
||||
container_name: watchtower
|
||||
image: containrrr/watchtower
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- TZ=Europe/Amsterdam
|
||||
- WATCHTOWER_CLEANUP=true
|
||||
- WATCHTOWER_POLL_INTERVAL=86400
|
||||
- WATCHTOWER_LABEL_ENABLE=true
|
||||
```
|
||||
|
95
_posts/2021-08-08-docker-nginx.md
Normal file
95
_posts/2021-08-08-docker-nginx.md
Normal file
@ -0,0 +1,95 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Docker NGINX"
|
||||
description: "Docker NGINX & Authelia"
|
||||
author: sthope
|
||||
image: "nginx-logo.png"
|
||||
categories: [ Docker, NGINX, LinuxServer ]
|
||||
env_file: https://git.sthope.dev/sthope/docker_portainer_stacks/src/branch/master/nginx/nginx.env
|
||||
comments: true
|
||||
---
|
||||
|
||||
- Create a file on your PC named `nginx.env` and paste this or [download this template]( {{page.env_file}} )
|
||||
|
||||
```
|
||||
domain=example.com
|
||||
domain_subdomains=homeassistant,plex,nodered,jellyfin,sonarr,radarr
|
||||
user_email=example@gmail.com
|
||||
nginx_validation=dns
|
||||
nginx_dnsplugin=cloudflare
|
||||
#nginx_duckdnstoken=
|
||||
nginx_container_name=nginx
|
||||
authelia_container_name=authelia
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
TZ=Europe/Amsterdam
|
||||
rst_mode=unless-stopped
|
||||
maximunddb_license_key=
|
||||
volume_nginx=/docker/nginx/nginx
|
||||
volume_authelia=/docker/nginx/authelia
|
||||
autoupdate_nginx=true
|
||||
autoupdate_authelia=true
|
||||
tag_nginx=latest
|
||||
tag_authelia=latest
|
||||
nginx_httpsPort=443
|
||||
nginx_httpPort=80
|
||||
```
|
||||
|
||||
Fill up according to your instalation
|
||||
|
||||
- Create and run this Portainer Stack:
|
||||
|
||||
```yaml
|
||||
version: "3.8"
|
||||
|
||||
networks:
|
||||
nginx_network:
|
||||
external:
|
||||
name: nginx_network
|
||||
default:
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: ghcr.io/linuxserver/swag:${tag_nginx}
|
||||
container_name: ${nginx_container_name}
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
networks:
|
||||
- nginx_network
|
||||
environment:
|
||||
- PUID=${PUID}
|
||||
- PGID=${PGID}
|
||||
- TZ=${TZ}
|
||||
- URL=${nginx_domain}
|
||||
- SUBDOMAINS=${nginx_subdomains}
|
||||
- VALIDATION=${nginx_validation}
|
||||
- DNSPLUGIN=${nginx_dnsplugin}
|
||||
- EMAIL=${user_email}
|
||||
- MAXMINDDB_LICENSE_KEY=${maximunddb_license_key}
|
||||
- STAGING=false
|
||||
- ONLY_SUBDOMAINS=false
|
||||
volumes:
|
||||
- ${volume_nginx}:/config
|
||||
ports:
|
||||
- ${nginx_httpsPort}:443
|
||||
- ${nginx_httpPort}:80
|
||||
restart: ${rst_mode}
|
||||
labels:
|
||||
- com.centurylinklabs.watchtower.enable=${autoupdate_nginx}
|
||||
|
||||
authelia:
|
||||
image: authelia/authelia:${tag_authelia}
|
||||
container_name: ${authelia_container_name}
|
||||
networks:
|
||||
- nginx_network
|
||||
environment:
|
||||
- PUID=${PUID}
|
||||
- PGID=${PGID}
|
||||
- TZ=${TZ}
|
||||
volumes:
|
||||
- ${volume_authelia}:/config
|
||||
restart: ${rst_mode}
|
||||
labels:
|
||||
- com.centurylinklabs.watchtower.enable=${autoupdate_authelia}
|
||||
```
|
53
_posts/2021-08-29-custom-cmds-in-ubuntu.md
Normal file
53
_posts/2021-08-29-custom-cmds-in-ubuntu.md
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Custom cmds in Ubuntu"
|
||||
description: "Create custom commands in Ubuntu (and other Linux distros)."
|
||||
author: sthope
|
||||
image: "bash-logo.png"
|
||||
categories: [ Ubuntu, Linux ]
|
||||
distro_tested: "Ubuntu 20.04"
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
<strong>⚠️⚠️⚠️</strong> This was done using {{page.distro_tested}} but it should work on most Linux distros the same way.
|
||||
|
||||
|
||||
<h2 id="part1">Create Folders</h2>
|
||||
On the terminal create folder to save your customs scripts eg:
|
||||
|
||||
```
|
||||
mkdir -p ~/bin
|
||||
```
|
||||
|
||||
<h2 id="part2">Create Scripts</h2>
|
||||
Inside the new folder created create a new file,eg:
|
||||
`nano ~/bin/y2upgrade`
|
||||
|
||||
<h2 id="part3">Edit the Scripts</h2>
|
||||
Edit the file with your commands and save, eg:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
```
|
||||
|
||||
<h2 id="part4">Set Access Permissions</h2>
|
||||
Use chmod to set files permissions. (should ask twice for sudo password)
|
||||
|
||||
```sudo chmod +x ~/bin/*;su -l $USER```
|
||||
|
||||
<h2 id="part5">Testing</h2>
|
||||
Now you should be able to send your command from the terminal, the file name is the command name for example now when entering: `y2upgrade` it should first do `sudo apt-get update` and then `sudo apt-get upgrade -y`.<br>
|
||||
<br>
|
||||
`-y` simply means it will not ask you Y/n if you want to accept installing the upgrades in case there is any.
|
||||
|
||||
<h2 id="part5">Extra</h2>
|
||||
SSH without asking for password.<br>
|
||||
Create file named `sshnopwd` and paste the [contents of this file](https://git.sthope.dev/sthope/sthope_website_examples/raw/branch/master/custom-cmds-in-ubuntu/bin_examples/sshnopwd)<br>
|
||||
|
||||
now instead of using `ssh username@ip` and then entering password, simply run `sshnopwd password username@ip` and it will automatically login.<br>
|
||||
|
||||
Small collection with more examples can be found [here](https://git.sthope.dev/sthope/sthope_website_examples/src/branch/master/custom-cmds-in-ubuntu/bin_examples)
|
106
_posts/2021-08-30-portainer-stacks.md
Normal file
106
_posts/2021-08-30-portainer-stacks.md
Normal file
@ -0,0 +1,106 @@
|
||||
---
|
||||
layout: post
|
||||
title: "Portainer Stacks"
|
||||
description: "Install Docker containers using docker-compose files with Portainer Stacks."
|
||||
author: sthope
|
||||
image: portainer-logo.png
|
||||
categories: [ Ubuntu, Linux ]
|
||||
pic01: "/assets/images/portainer_stacks/1.jpg"
|
||||
pic02: "/assets/images/portainer_stacks/2.jpg"
|
||||
pic03: "/assets/images/portainer_stacks/3.jpg"
|
||||
pic04: "/assets/images/portainer_stacks/4.jpg"
|
||||
pic05: "/assets/images/portainer_stacks/5.jpg"
|
||||
pic06: "/assets/images/portainer_stacks/6.jpg"
|
||||
pic07: "/assets/images/portainer_stacks/7.jpg"
|
||||
pic08: "/assets/images/portainer_stacks/8.jpg"
|
||||
pic09: "/assets/images/portainer_stacks/9.jpg"
|
||||
pic10: "/assets/images/portainer_stacks/10.jpg"
|
||||
pic11: "/assets/images/portainer_stacks/11.jpg"
|
||||
pic12: "/assets/images/portainer_stacks/12.jpg"
|
||||
pic13: "/assets/images/portainer_stacks/13.jpg"
|
||||
pic14: "/assets/images/portainer_stacks/14.jpg"
|
||||
pic15: "/assets/images/portainer_stacks/15.jpg"
|
||||
stack_example: "https://git.sthope.dev/sthope/docker_portainer_stacks/src/branch/master/libreoffice.yml"
|
||||
comments: true
|
||||
---
|
||||
### Installling Portainer
|
||||
|
||||
There are a few ways of running docker containers, it should not matter which way your prefer most.
|
||||
Here are some examples
|
||||
|
||||
via Terminal, open the terminal and enter:
|
||||
```
|
||||
docker volume create portainer_data; \
|
||||
docker run -d \
|
||||
-p 8000:8000 \
|
||||
-p 9000:9000 \
|
||||
--name=portainer \
|
||||
--restart=always \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v portainer_data:/data \
|
||||
--labels com.centurylinklabs.watchtower.enable=true \
|
||||
--network_mode=bridge \
|
||||
portainer/portainer-ce:latest
|
||||
```
|
||||
<br>
|
||||
<br>
|
||||
via docker-compose.yml file
|
||||
Create `docker-compose.yml` file, eg: `nano ~/docker/docker-compose.yml` and paste:
|
||||
|
||||
```
|
||||
---
|
||||
version: "3.8"
|
||||
services:
|
||||
portainer:
|
||||
container_name: "portainer"
|
||||
image: "portainer/portainer-ce:latest"
|
||||
restart: "always"
|
||||
network_mode: "bridge"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
- "portainer_data:/data"
|
||||
port:
|
||||
- "8000:8000"
|
||||
- "9000:9000"
|
||||
labels:
|
||||
- "com.centurylinklabs.watchtower.enable=true"
|
||||
|
||||
volumes:
|
||||
portainer_data:
|
||||
external: false
|
||||
```
|
||||
|
||||
<br>
|
||||
### Portainer WebUI
|
||||
|
||||
Portainer should now be available at: http://IP:9000.<br>
|
||||
|
||||
1. Configure `Username` and `Password` to `Create user`.
|
||||
<br>
|
||||
2. Select `Docker` and `Connect`.
|
||||
<br>
|
||||
3. Click in `local` to access your instance.
|
||||
<br>
|
||||
4. Navigate to `Endpoints` on the left-side menu and click on `local` to edit.
|
||||
<br>
|
||||
5. In `Public IP` put the IP address of Portainer. Bonus you can name it differently if you want. After `Public IP` configured press `Update Endpoint`.
|
||||
<br>
|
||||
6. Navigate to `Stacks` on the left-side menu.
|
||||
<br>
|
||||
7. Here you can paste most docker-compose.yml files or create your own.
|
||||
<br>
|
||||
8. For example:
|
||||
<br>
|
||||
9. Here you can upload Stacks directly from Github, Gitea and many others.
|
||||
<br>
|
||||
10. Here is a example using [this personal Gitea server]({{page.stack_example}}).
|
||||
<br>
|
||||
11. Stack running
|
||||
<br>
|
||||
12. Inside the `Stack`
|
||||
<br>
|
||||
13. Updating/Editing the `Stack` locally.
|
||||
<br>
|
||||
14. Stack file can also be edited on Git and pushed again to assume the changes.
|
||||
<br>
|
||||
|
Reference in New Issue
Block a user