feat: Mise à jour

This commit is contained in:
xavier committed 2024-03-13 23:14:26 +01:00
1 parent 6ebedbeca3
commit 91045fa232
19 files changed
+337 -27

No files matched your search

+16
View File
@@ -1 +1,17 @@
# lxc-profiles # lxc-profiles
## Create traefik instance
### Create container
lxc init ubuntu:lts -p default -p zfs -p front -p traefik -p letsencrypt traefik
### Fix ip address
lxc network attach front traefik eth0 eth0
lxc config device set traefik eth0 ipv4.address 10.112.16.10
### Start it
lxc start traefik
### Check it
lxc exec traefik -- cloud-init status --wait
lxc shell traefik
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# See https://microk8s.io/docs/install-lxd
lxc profile create microk8s
curl https://raw.githubusercontent.com/ubuntu/microk8s/master/tests/lxc/microk8s.profile | lxc profile edit microk8s
# Import the baseimage
lxc image copy ubuntu:lts local: --auto-update --copy-aliases
# Create an instance
lxc launch -p default -p microk8s ubuntu:lts microk8s
# Fix the ip address
lxc network attach lxdbr0 microk8s eth0 eth0
lxc config device set microk8s eth0 ipv4.address 10.162.242.10
# Install microk8s inside the container
lxc exec microk8s -- sudo snap install microk8s --classic
+19
View File
@@ -0,0 +1,19 @@
config:
dns.domain: back.lxd
dns.zone.forward: back.lxd
ipv4.address: 10.112.17.1/24
ipv4.nat: "true"
ipv6.address: fd42:7d68:cedd:4230::1/64
ipv6.nat: "true"
description: ""
name: back
type: bridge
used_by:
- /1.0/instances/gitea
- /1.0/instances/postgresql
- /1.0/profiles/back
- /1.0/profiles/frontback
managed: true
status: Created
locations:
- none
+11
View File
@@ -0,0 +1,11 @@
type: bridge
name: front
description: "Frontend network"
managed: true
config:
dns.domain: front.lxd
dns.zone.forward: front.lxd
ipv4.address: 10.112.16.1/24
ipv4.nat: "true"
ipv6.address: fd42:b32e:5d52:d666::1/64
ipv6.nat: "true"
+9
View File
@@ -0,0 +1,9 @@
type: bridge
name: home
description: "home network"
managed: true
config:
dns.domain: home.lxd
dns.zone.forward: home.lxd
ipv4.address: 192.168.100.1/24
ipv4.nat: "false"
+12
View File
@@ -0,0 +1,12 @@
name: public
description: "Public network"
type: bridge
managed: true
config:
dns.domain: public.lxd
dns.zone.forward: public.lxd
ipv4.address: 10.112.88.1/24
ipv4.nat: "true"
ipv6.address: 2001:41d0:a:3568::5/64
ipv6.nat: "false"
ipv6.dhcp.stateful: true
@@ -0,0 +1,110 @@
name: app-pydio
description: Install pydio cells
config:
cloud-init.vendor-data: |
#cloud-config
timezone: Europe/Paris
locale: fr_FR.UTF-8
# Packages
package_update: true
package_upgrade: true
packages:
- tar
- unzip
- wget
- git
# Users
users:
- default
- name: pydio
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
write_files:
- path: "/etc/systemd/system/pydio.service"
owner: root:root
permissions: "0644"
content: |
[Unit]
Description=Pydio Cells
Documentation=https://pydio.com
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/opt/pydio/bin/cells
[Service]
User=pydio
Group=pydio
WorkingDirectory=/home/pydio
PermissionsStartOnly=true
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/opt/pydio/bin/cells start
Restart=on-failure
StandardOutput=journal
StandardError=inherit
LimitNOFILE=65536
TimeoutStopSec=5
KillSignal=INT
SendSIGKILL=yes
SuccessExitStatus=0
# Add environment variables
Environment=CELLS_WORKING_DIR=/var/pydio/cells
Environment=CELLS_ENABLE_METRICS=false
Environment=CELLS_SITE_NO_TLS=1
[Install]
WantedBy=multi-user.target
- path: "/tmp/pydio-install.yaml"
content: |
# This is the minimal configuration to directly start a pre-configured server in sandbox mode
# Adapt to your convenience and report to the documentation to explore further possibilities.
# Environment variables are defined in .env file and injected at run time.
proxyconfigs:
- binds:
- 0.0.0.0:8080
reverseproxyurl: http://pydio.front.lxd:8080
# WebUI Admin definition
frontendlogin: admin
frontendpassword: TOBECHANGED
# DB connection
dbconnectiontype: tcp
dbtcphostname: 10.112.17.20
dbtcpport: 3306
dbtcpname: cells
dbtcpuser: pydio
dbtcppassword: TOBECHANGED
runcmd:
# Wait for network to be ready
- [ sleep, '5' ]
# Install pydio cells binary
- [ mkdir, '--parents' , '/opt/pydio/bin' , '/var/pydio/cells' ]
- >
wget 'https://download.pydio.com/latest/cells/release/%7Blatest%7D/linux-amd64/pydio-cells-%7Blatest%7D-linux-amd64.zip' -O /tmp/pydio-cells.zip
&& unzip -d /opt/pydio/bin /tmp/pydio-cells.zip cells
&& rm /tmp/pydio-cells.zip
- [ chmod, '+x', '/opt/pydio/bin/cells' ]
# Copy pydio install file
- [ cp, /tmp/pydio-install.yaml, /home/pydio/install.yaml ]
- [ chown, '--recursive', 'pydio:pydio', '/home/pydio', '/opt/pydio' , '/var/pydio/cells' ]
# Initial setup
- sudo -u pydio -i -- bash -c "CELLS_INSTALL_YAML=/home/pydio/install.yaml CELLS_WORKING_DIR=/var/pydio/cells /opt/pydio/bin/cells configure"
# Enable and start the service
- [ systemctl, daemon-reload ]
- [ systemctl, enable, --now, pydio.service ]
devices:
data:
type: disk
pool: zfs
source: pydio-data
path: /var/pydio/cells
+6 -22
View File
@@ -13,30 +13,14 @@ config:
packages: packages:
- unzip - unzip
# Users # users:
users: # - default
- default # - name: gitea
- name: gitea # groups: sudo
groups: sudo # shell: /bin/bash
shell: /bin/bash # sudo: ['ALL=(ALL) NOPASSWD:ALL']
sudo: ['ALL=(ALL) NOPASSWD:ALL']
# Configure second network interface
write_files:
- path: "/etc/netplan/eth1.yaml"
permissions: "0755"
content: |
network:
version: 2
ethernets:
eth1:
dhcp4: true
runcmd: runcmd:
# Apply network config
- [ netplan, generate ]
- [ netplan, apply ]
# Install gitea # Install gitea
- [ snap, install, gitea ] - [ snap, install, gitea ]
@@ -0,0 +1,20 @@
name: mariadb
description: Install mariadb
config:
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
- mariadb-server
timezone: Europe/Paris
locale: fr_FR.UTF-8
runcmd:
# Bind on all interfaces
- sed -i -e 's,\(bind-address.*\)127.0.0.1,\10.0.0.0,g' /etc/mysql/mariadb.conf.d/50-server.cnf
devices:
data:
type: disk
pool: zfs
source: mariadb-data
path: /var/lib/mysql
@@ -0,0 +1,8 @@
name: traefik-config
description: "Volume to mount traefik config dir from host"
devices:
config:
type: disk
source: /home/ubuntu/infra/new/traefik/config
path: /etc/traefik
shift: "true"
@@ -0,0 +1,8 @@
name: docker-volume-data
description: "A profile that add a volume for docker data"
devices:
docker-data:
type: disk
pool: btrfs
source: docker-data
path: /var/lib/docker
@@ -0,0 +1,8 @@
name: docker-volume-manifests
description: "A profile that mount a manifests directory from the host"
devices:
manifests:
path: /home/ubuntu/manifests
shift: "true"
source: /home/ubuntu/infra/new/docker/manifests
type: disk
@@ -0,0 +1,25 @@
name: docker
description: "A profile that deploy docker in an LXD container"
config:
linux.kernel_modules: overlay
raw.lxc: |-
lxc.apparmor.profile = unconfined
lxc.cgroup.devices.allow = a
lxc.mount.auto=proc:rw sys:rw
lxc.cap.drop =
security.nesting: "true"
security.privileged: "true"
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
runcmd:
- curl https://get.docker.com | sh
# Provision two network bridges
- sleep 30
- docker network create --driver bridge --subnet=172.25.0.0/24 front
- docker network create --driver bridge --subnet=172.30.0.0/24 back
timezone: Europe/Paris
locale: fr_FR.UTF-8
@@ -0,0 +1,40 @@
name: microk8s
description: "A profile that deploy microk8s in an LXD container"
devices:
aadisable:
path: /sys/module/nf_conntrack/parameters/hashsize
source: /sys/module/nf_conntrack/parameters/hashsize
type: disk
aadisable2:
path: /dev/zfs
source: /dev/zfs
type: disk
aadisable3:
path: /dev/kmsg
source: /dev/kmsg
type: unix-char
aadisable4:
path: /sys/fs/bpf
source: /sys/fs/bpf
type: disk
aadisable5:
path: /proc/sys/net/netfilter/nf_conntrack_max
source: /proc/sys/net/netfilter/nf_conntrack_max
type: disk
config:
linux.kernel_modules: ip_vs,ip_vs_rr,ip_vs_wrr,ip_vs_sh,ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,br_netfilter
raw.lxc: |
lxc.apparmor.profile=unconfined
lxc.mount.auto=proc:rw sys:rw cgroup:rw
lxc.cgroup.devices.allow=a
lxc.cap.drop=
security.nesting: "true"
security.privileged: "true"
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
runcmd:
- [ 'snap', 'install', 'microk8s', '--classic' ]
timezone: Europe/Paris
locale: fr_FR.UTF-8
+5
View File
@@ -0,0 +1,5 @@
name: size-large
description: "Large sized instance limits"
limits:
cpu: 4
memory: 8GB
+5
View File
@@ -0,0 +1,5 @@
name: size-medium
description: "Medium sized instance limits"
limits:
cpu: 2
memory: 4GB
+7
View File
@@ -0,0 +1,7 @@
name: proxy-docker
description: Expose private docker sock via tcp on the host
devices:
dockersock:
type: proxy
listen: tcp:0.0.0.0:2375
connect: unix:/run/docker.sock
+7
View File
@@ -0,0 +1,7 @@
name: proxy-taskwarrior
description: Proxify taskwarrior server tcp traffic to the instance
devices:
hostport53589:
type: proxy
listen: tcp:0.0.0.0:53589
connect: tcp:127.0.0.1:53589
+2 -5
View File
@@ -1,11 +1,8 @@
config: {} name: certificates
description: "" description: "Volume to mount letsencrypt certificates from host"
devices: devices:
certificates: certificates:
path: /certificates path: /certificates
shift: "true" shift: "true"
source: /etc/letsencrypt/live source: /etc/letsencrypt/live
type: disk type: disk
name: certificates
used_by:
- /1.0/instances/docker?project=docker