mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-08 21:34:25 +00:00
chore(turris): try and fail to create a gitea lxc container
This commit is contained in:
34
knowledge base/dhcpcd.md
Normal file
34
knowledge base/dhcpcd.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# dhcpcd
|
||||||
|
|
||||||
|
1. [TL;DR](#tldr)
|
||||||
|
|
||||||
|
## TL;DR
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Usage</summary>
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Start on specific interfaces.
|
||||||
|
dhcpcd 'eth0'
|
||||||
|
|
||||||
|
# Release the current IP address.
|
||||||
|
dhcpcd -k 'eth0'
|
||||||
|
dhcpcd --release 'eth0'
|
||||||
|
|
||||||
|
# Stop
|
||||||
|
dhcpcd -x
|
||||||
|
dhcpcd --exit
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Reference
|
||||||
|
═╬═Time══
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- In-article sections -->
|
||||||
|
<!-- Knowledge base -->
|
||||||
|
<!-- Files -->
|
||||||
|
<!-- Upstream -->
|
||||||
|
<!-- Others -->
|
||||||
@@ -19,6 +19,10 @@ ls '/usr/share/lxc/templates'
|
|||||||
# List the options supported by templates.
|
# List the options supported by templates.
|
||||||
lxc-create -t 'download' -h
|
lxc-create -t 'download' -h
|
||||||
|
|
||||||
|
# List the available images.
|
||||||
|
lxc-create -t 'download' -- -l
|
||||||
|
lxc-create -t 'download' -- --list
|
||||||
|
|
||||||
# Create containers.
|
# Create containers.
|
||||||
# Use the 'download' template to choose from a list of distribution.
|
# Use the 'download' template to choose from a list of distribution.
|
||||||
lxc-create -n 'nas' -t 'download'
|
lxc-create -n 'nas' -t 'download'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ uci show 'dhcp'
|
|||||||
# Show what interface is the WAN.
|
# Show what interface is the WAN.
|
||||||
uci show network.wan.device | cut -d "'" -f 2
|
uci show network.wan.device | cut -d "'" -f 2
|
||||||
|
|
||||||
# Configure a static IP address lease.
|
# Configure static IP address leases.
|
||||||
uci add dhcp host
|
uci add dhcp host
|
||||||
uci set dhcp.@host[-1].name='hostname'
|
uci set dhcp.@host[-1].name='hostname'
|
||||||
uci set dhcp.@host[-1].mac='11:22:33:44:55:66'
|
uci set dhcp.@host[-1].mac='11:22:33:44:55:66'
|
||||||
@@ -26,7 +26,12 @@ uci set dhcp.@host[-1].ip='192.168.1.2'
|
|||||||
uci commit 'dhcp'
|
uci commit 'dhcp'
|
||||||
reload_config
|
reload_config
|
||||||
|
|
||||||
# Use a different port as WAN switching it with one in LAN.
|
# Delete list elements.
|
||||||
|
uci del 'dhcp.@host[12]'
|
||||||
|
uci commit 'dhcp'
|
||||||
|
reload_config
|
||||||
|
|
||||||
|
# Use a different port as WAN by swapping the default one with another one in LAN.
|
||||||
uci set network.wan.device='lan4'
|
uci set network.wan.device='lan4'
|
||||||
uci del_list network.br_lan.ports='lan4'
|
uci del_list network.br_lan.ports='lan4'
|
||||||
uci add_list network.br_lan.ports='eth2'
|
uci add_list network.br_lan.ports='eth2'
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
lxc-create -n 'alpine' -t 'download' -- -d 'Alpine' -r '3.18' -a 'armv7l'
|
|
||||||
|
|
||||||
uci add dhcp 'host'
|
|
||||||
uci set dhcp.@host[-1].name='alpine'
|
|
||||||
uci set dhcp.@host[-1].mac="$(grep 'hwaddr' '/srv/lxc/alpine/config' | sed 's/.*= //')"
|
|
||||||
uci set dhcp.@host[-1].ip='192.168.111.2'
|
|
||||||
uci commit 'dhcp'
|
|
||||||
reload_config
|
|
||||||
luci-reload
|
|
||||||
45
snippets/turris-os.sh
Normal file
45
snippets/turris-os.sh
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Create alpine-based containers.
|
||||||
|
lxc-create -n 'alpine' -t 'download' -- -d 'Alpine' -r '3.18' -a 'armv7l'
|
||||||
|
|
||||||
|
# Set static leases.
|
||||||
|
uci add dhcp 'host'
|
||||||
|
uci set dhcp.@host[-1].name='alpine'
|
||||||
|
uci set dhcp.@host[-1].mac="$(grep 'hwaddr' '/srv/lxc/alpine/config' | sed 's/.*= //')"
|
||||||
|
uci set dhcp.@host[-1].ip='192.168.111.2'
|
||||||
|
uci commit 'dhcp'
|
||||||
|
reload_config
|
||||||
|
luci-reload
|
||||||
|
|
||||||
|
# Start containers at boot.
|
||||||
|
cat <<EOF | tee -a '/etc/config/lxc-auto'
|
||||||
|
config container
|
||||||
|
option name alpine
|
||||||
|
option timeout 60
|
||||||
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# Example: Gitea container
|
||||||
|
##
|
||||||
|
|
||||||
|
lxc-create -n 'gitea' -t 'download' -- -d 'Gentoo' -r 'openrc' -a 'armv7l'
|
||||||
|
uci add dhcp 'host'
|
||||||
|
uci set dhcp.@host[-1].name='gitea'
|
||||||
|
uci set dhcp.@host[-1].mac="$(grep 'hwaddr' '/srv/lxc/gitea/config' | sed 's/.*= //')"
|
||||||
|
uci set dhcp.@host[-1].ip='192.168.111.252'
|
||||||
|
uci commit 'dhcp'
|
||||||
|
reload_config
|
||||||
|
luci-reload
|
||||||
|
cat <<EOF | tee -a '/etc/config/lxc-auto'
|
||||||
|
config container
|
||||||
|
option name gitea
|
||||||
|
option timeout 60
|
||||||
|
EOF
|
||||||
|
lxc-start 'gitea'
|
||||||
|
lxc-attach 'gitea'
|
||||||
|
uci del 'dhcp.@host[12]'
|
||||||
|
uci commit 'dhcp'
|
||||||
|
reload_config
|
||||||
|
luci-reload
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cat <<EOF | tee -a '/etc/config/lxc-auto'
|
|
||||||
config container
|
|
||||||
option name alpine
|
|
||||||
option timeout 60
|
|
||||||
EOF
|
|
||||||
Reference in New Issue
Block a user