Compare commits

..

192 commits

Author SHA1 Message Date
59a0b086ff remove reload - unknown function 2024-06-23 14:33:31 +02:00
df4882c57d update states to be compatible w. alpine 3.20 2024-05-30 20:41:51 +02:00
e41472b1c3 add screen to base packages 2024-05-13 11:18:43 +02:00
10b80ae3fd add rsync 2024-03-16 20:20:48 +01:00
d2e1f428db fix /tmp mountpoint 2024-03-10 12:41:50 +01:00
001c5433ab configure tmpfs size via pillar 2024-03-10 12:39:17 +01:00
0f72484966 add volatile tmpfs 2024-03-10 12:37:30 +01:00
b9565754ad delete nginx 2024-03-09 21:45:13 +01:00
6d8f0a8082 add serverspecific to .gitignore 2024-03-09 21:21:19 +01:00
cb3e6a0d81 add serverspecific states 2024-03-09 21:09:15 +01:00
41d0cfb79e require manual restart of haproxy service 2024-03-09 21:06:58 +01:00
6178d31613 fix host-ssh timeout 2024-03-09 21:03:28 +01:00
69d293eb11 disable host-ssh timeout, add timeout connect 2024-03-09 18:40:15 +01:00
61dc8203ac disable host-ssh timeout 2024-03-09 18:34:06 +01:00
5ec693114f update disk.timestamp pillar 2024-03-09 17:47:22 +01:00
c71ab09614 wip 2024-03-09 17:42:43 +01:00
91145dade2 try dynamic ips 2 2024-02-22 22:08:03 +01:00
e427bbbdaa try dynamic ips 2024-02-22 22:07:19 +01:00
70887e076c watch in haproxy config for changes 2024-02-22 21:54:46 +01:00
95d8935d6a add haproxy config 2 2024-02-22 21:52:00 +01:00
da1c001330 add haproxy config 2024-02-22 21:51:05 +01:00
7f1dc9e842 edit systemupdate, remove pillar git 2024-02-22 21:13:20 +01:00
c530a5a36d Fix interfaces 2 2024-02-22 21:10:20 +01:00
b2c1b81262 Fix interfaces 2 2024-02-22 21:09:49 +01:00
9043b01d3a Fix interfaces 2024-02-22 21:06:38 +01:00
713c1800ec Fix haproxy 2024-02-22 20:36:13 +01:00
bb1c9f29eb Add haproxy 2024-02-22 20:33:44 +01:00
4cd211da63 add config files 2024-02-02 16:39:22 +01:00
bd07e76d36 fix typos 2024-02-02 16:35:39 +01:00
c64e5bcdcc fix typo 2024-02-02 16:32:59 +01:00
a54d81fce7 Add nginx profiles 2024-02-02 16:32:15 +01:00
2b1c1cd89e enable nginx service 2024-02-02 12:03:10 +01:00
45a2c3e465 fix states to match pillars 2024-02-02 11:49:44 +01:00
e50b94f6a5 podman - invalid user password 2024-02-02 11:31:23 +01:00
0fff902b20 remove certbot 2024-02-02 11:27:35 +01:00
3fe9fa7886 test profiles 2024-02-02 00:18:08 +01:00
2c574ef2c5 fix states 2024-02-02 00:02:42 +01:00
9bc36a0db9 fix states 2024-02-02 00:00:23 +01:00
560e82903b fix states 2024-02-01 23:58:36 +01:00
72dc7fed8d add nginx states, add separate directories state 2024-02-01 23:39:22 +01:00
2c76821ff4 firewall - add port 80 2024-01-11 20:26:30 +01:00
d8d2a5f7ef Edit PS1 2024-01-11 20:02:56 +01:00
700a4ecf14 Fix mkinitfs generation 2024-01-11 18:29:49 +01:00
4b0cee8e84 Add wireguard-port 2024-01-06 13:07:11 +01:00
1ca17e65e9 Move podman-apps to podman/apps, Add pms-cli 2024-01-05 23:21:28 +01:00
4d3385e1af Fix typos 2023-12-31 16:18:29 +01:00
057e93d8bf Fix typo 2023-12-31 16:11:22 +01:00
0706e73f28 Add systemupdate script 2023-12-31 14:44:03 +01:00
5972218cc7 Add /etc/issue 2023-12-31 14:31:53 +01:00
1fcb1fd13f Enable sysfs service on boot 2023-12-31 14:21:48 +01:00
82667c0c86 system/base.sls - add curl pkg 2023-12-23 13:01:09 +01:00
0d22ea8397 system/base.sls - enable sysctl & syslog service 2023-12-23 12:48:31 +01:00
4ddca813a2 podman/user.sls - Add random password for puser 2023-12-23 12:36:32 +01:00
169c969b46 Fix permissions 2 2023-12-22 23:21:16 +01:00
18e0454807 Fix permissions, add poddoc config 2023-12-22 23:20:26 +01:00
43c18520be remove containers, add poddoc 2023-12-22 23:05:54 +01:00
596ecf346f Remove default .container of podman init.sls 2023-12-21 18:45:48 +01:00
fbfc842125 Fix typo 2023-12-21 18:43:21 +01:00
c19eac0344 Fix typo 2023-12-21 18:42:04 +01:00
81b5fffe51 Fix motd 2023-12-21 18:36:08 +01:00
4c163468f9 Fix dependency of system_bootloader_motd 2023-12-21 15:32:03 +01:00
ce499f3d3b Fix typo 2023-12-21 14:31:09 +01:00
33d564268f Refactor 2023-12-21 14:20:42 +01:00
ce02589fe2 Edit git url's 2023-11-24 18:21:37 +01:00
5be819b1e0 Move util => apps, Add generate_motd 2023-11-24 18:05:52 +01:00
LinuxSquare
fb821f8b68 disks: make / shared - rootless podman 2023-11-06 21:13:36 +01:00
LinuxSquare
cf623b3261 base: remove /etc/modules file watch 2023-11-06 21:09:22 +01:00
LinuxSquare
d575e98493 podman: remove conf.d changes 2023-11-06 21:05:26 +01:00
LinuxSquare
ad7c12712a podman: changes to mariadb, forgejo, npm & service 2023-11-05 21:38:04 +01:00
LinuxSquare
6464bc170b podman - npm: disable privileged ports 2 2023-10-27 17:24:15 +02:00
LinuxSquare
1d83a8c9e7 podman - npm: disable privileged ports 2023-10-27 17:22:14 +02:00
LinuxSquare
6e020a8333 podman - npm: redefine unprivileged ports 2023-10-27 17:09:51 +02:00
LinuxSquare
ed36fb8041 podmam - npm: Add unprivileged ports to sysctl 2023-10-27 17:06:10 +02:00
LinuxSquare
850d7a23eb podman: fix mistakes 2023-10-27 16:59:59 +02:00
LinuxSquare
eb9c52a19b podman: add mariadb, forgejo, npm containers 2023-10-27 16:56:26 +02:00
LinuxSquare
f9748745dd podman: add ssh-keys to podman-user 2023-10-27 00:06:47 +02:00
LinuxSquare
4faa7f0541 mariadb: fix includes 2023-10-27 00:01:16 +02:00
LinuxSquare
b0ac9dc850 Restructure states, add podman package install workaround 2023-10-26 23:59:19 +02:00
LinuxSquare
552908f0b9 try @testing-repo 4 2023-10-20 18:30:56 +02:00
LinuxSquare
84e8b6565e try @testing-repo 3 2023-10-20 18:28:48 +02:00
LinuxSquare
1dfa1991aa remove apk.sls 2023-10-20 18:23:26 +02:00
LinuxSquare
038932520f try @testing-repo 2 2023-10-20 18:21:45 +02:00
LinuxSquare
e4e98cd246 try @testing-repo 2023-10-20 18:18:16 +02:00
LinuxSquare
ce01fd7deb Add testing repo 2023-10-20 18:15:17 +02:00
LinuxSquare
b495f8ffd5 Add sudo 2023-10-20 17:42:49 +02:00
LinuxSquare
77ccd7a161 Add tun permission fix service workaround 2023-10-20 17:34:19 +02:00
LinuxSquare
5c9b6bd8eb Podman confd 2023-10-20 17:20:39 +02:00
LinuxSquare
013d209a5d Cleanup unused states 2023-10-20 17:15:10 +02:00
LinuxSquare
97e033a6ca Rework podman rootless 9 2023-10-20 17:09:32 +02:00
LinuxSquare
df84e679a1 Rework podman rootless 8 2023-10-20 17:08:32 +02:00
LinuxSquare
1942b50e92 Rework podman rootless 7 2023-10-20 17:03:57 +02:00
LinuxSquare
eb5197eb1c Rework podman rootless 6 2023-10-20 17:03:02 +02:00
LinuxSquare
49e4b3a9d0 Rework podman rootless 5 2023-10-20 17:02:20 +02:00
LinuxSquare
5dafb934d8 Rework podman rootless 4 2023-10-20 16:50:12 +02:00
LinuxSquare
fd2cbc8d1d Rework podman rootless 3 2023-10-20 16:48:05 +02:00
LinuxSquare
9fe2253e2d Rework podman rootless 2 2023-10-20 16:43:17 +02:00
LinuxSquare
3fed00c6d2 Rework podman rootless 2023-10-20 16:42:39 +02:00
LinuxSquare
6028bfad05 Edit subgid, subuid 2023-10-20 16:33:15 +02:00
LinuxSquare
c88b9d6e3b Fix puser 2023-10-20 16:32:26 +02:00
LinuxSquare
1ee398f327 Podman rootless 2023-10-20 16:30:44 +02:00
LinuxSquare
0bef59f023 Fix os-release 2023-10-20 15:25:22 +02:00
LinuxSquare
a680351797 Fix os-release requirements 2023-10-20 15:24:51 +02:00
LinuxSquare
5dfb28dfd8 Fix os-release 2023-10-20 15:23:55 +02:00
LinuxSquare
c1d1403ea3 WIP 2023-10-20 15:19:22 +02:00
LinuxSquare
c832e1ea81 Remove OS_RELEASE from /etc/os-release, will be appended if not found 2023-10-20 15:17:42 +02:00
LinuxSquare
e219ede7eb Add OS_RELEASE to /etc/os-release 2023-10-20 15:16:35 +02:00
LinuxSquare
8d5bc2f8f2 Move create /usr/local/noveria/etc, move noveriablcgen.json to noveria/etc 2023-10-20 15:08:22 +02:00
LinuxSquare
20fe7f5b99 network/firewall_rules.nft - prevent printing for-loop newline 2023-10-20 15:02:19 +02:00
LinuxSquare
f1cc7be542 Fix network/init.sls 2023-10-20 14:31:56 +02:00
LinuxSquare
57e7f057c6 Switch from iptables to nftables, add separate network states 2023-10-20 14:27:22 +02:00
LinuxSquare
2dc09181ac Remove btrfs modprobe 2023-10-02 22:57:20 +02:00
LinuxSquare
6aa86cbd73 Require basic os-release states for motd 2023-09-30 11:55:03 +02:00
LinuxSquare
5f432e16c9 Move motd to candy-state, edit salt-minion config 2023-09-30 11:38:03 +02:00
LinuxSquare
35da420376 Add BUG_REPORT_URL to motd 2023-09-29 22:35:56 +02:00
LinuxSquare
51ac687063 Remove envsubst 2023-09-29 22:24:18 +02:00
LinuxSquare
3ff3f06683 Add envsubst 2023-09-29 22:09:49 +02:00
LinuxSquare
bc08431e91 Remove grub from states 2023-09-29 21:39:39 +02:00
LinuxSquare
ec632c9e90 Add force_reset 2023-09-29 21:34:16 +02:00
LinuxSquare
45478a247f Switch NAME to PRETTY_NAME 2023-09-29 21:20:47 +02:00
LinuxSquare
11c0a1dfe6 Re-add os-release - set os_family grain to Alpine 2023-09-29 21:14:44 +02:00
LinuxSquare
2096e36845 fix motd 2023-09-29 20:50:04 +02:00
LinuxSquare
459130293c Readd motd, remove os-release 2023-09-29 20:39:30 +02:00
LinuxSquare
3e3b4287db Cleanup 101 2023-09-29 20:31:59 +02:00
LinuxSquare
627400942b Cleanup 100 2023-09-29 20:31:31 +02:00
LinuxSquare
132ba0aee1 Remove jinja stuff 2023-09-29 20:30:56 +02:00
LinuxSquare
218910bb39 Add motd 2023-09-29 20:29:11 +02:00
LinuxSquare
c26e6f8441 Add os-release 2023-09-29 20:25:27 +02:00
LinuxSquare
1e53d3b81c Remove motd, remote os-release 2023-09-29 20:17:30 +02:00
LinuxSquare
154249141b try to fix forbidden jinja syntax 3 2023-09-29 19:59:18 +02:00
LinuxSquare
317f327b51 try to fix forbidden jinja syntax 2 2023-09-29 19:58:19 +02:00
LinuxSquare
364f477f7d fix forbidden jinja syntax 2023-09-29 19:50:52 +02:00
LinuxSquare
c8c08e774a Add os-release, add motd 2023-09-29 19:47:31 +02:00
LinuxSquare
0d35bc4902 Change filename 2023-09-29 18:59:34 +02:00
LinuxSquare
6bdf4119c9 Rework mariadb 2 2023-09-29 18:40:32 +02:00
LinuxSquare
176e5bbb8a Rework mariadb 2023-09-29 18:38:56 +02:00
LinuxSquare
681e515d47 Add grub.cfg to noveriablcgen.json 2023-09-29 18:34:14 +02:00
LinuxSquare
2da1116e9d Rework shell 2023-09-29 18:13:56 +02:00
LinuxSquare
600732234b Rework shell 2023-09-29 17:53:55 +02:00
LinuxSquare
5f1a9e63ba Add root to users 2023-09-29 17:41:57 +02:00
LinuxSquare
4e78606061 Fix mariadb 2023-09-29 17:37:26 +02:00
LinuxSquare
8978fea0b3 Fix noveriblcgen 2023-09-29 17:26:56 +02:00
LinuxSquare
8046479308 Fix shell 2023-09-29 17:25:29 +02:00
LinuxSquare
1de665cd14 edit noveriablcgen 2023-09-29 16:59:37 +02:00
LinuxSquare
ab0306ba90 Add git, remove localization, edit noveriablcgen 2023-09-29 16:54:02 +02:00
LinuxSquare
0a860df1bd Replace apps_dir => app_dir 2023-09-29 16:45:29 +02:00
LinuxSquare
aec4020088 Add more newlines to files 2023-09-29 16:40:14 +02:00
LinuxSquare
7033162e4b Add newline to shell 2023-09-29 16:39:27 +02:00
LinuxSquare
e8e6ff3596 Add noveriablcgen, add shell, add salt, add localization 2023-09-29 16:38:32 +02:00
LinuxSquare
8b2f421084 Add network.sls, edit fstab, begin of noveriablcgen to generate grub boot-entries 2023-09-20 21:09:26 +02:00
LinuxSquare
ccf97b505c Revert "Replace grub with syslinux"
This reverts commit 084ba2e892.
2023-08-22 22:32:31 +02:00
LinuxSquare
084ba2e892 Replace grub with syslinux 2023-08-20 21:53:25 +02:00
LinuxSquare
a21f795f24 Add networking 2023-07-30 13:01:00 +02:00
LinuxSquare
c34599d749 try to fix grub 7.10 2023-07-18 21:51:12 +02:00
LinuxSquare
7acfbf8def try to fix grub 7.9 2023-07-18 21:46:25 +02:00
LinuxSquare
970c6cc4a4 try to fix grub 7.8 2023-07-18 21:39:44 +02:00
LinuxSquare
cc004b176c try to fix grub 7.7 2023-07-18 21:28:39 +02:00
LinuxSquare
a6b88e120e try to fix grub 7.6 2023-07-18 21:10:07 +02:00
LinuxSquare
76313c8eb8 try to fix grub 7.5 2023-07-18 20:59:36 +02:00
LinuxSquare
eccd75219d try to fix grub 7 2023-07-18 20:55:59 +02:00
LinuxSquare
0eb57aea9d try to fix grub 6 2023-07-18 20:38:02 +02:00
LinuxSquare
df040cbc03 try to fix grub 5 2023-07-17 21:12:02 +02:00
LinuxSquare
1816659ace try to fix grub 4 2023-07-17 20:59:17 +02:00
LinuxSquare
cc2eea5338 try to fix grub 3 2023-07-17 20:52:09 +02:00
LinuxSquare
52f3ed9546 try to fix grub 2 2023-07-17 20:47:01 +02:00
LinuxSquare
d23e62b728 try to fix grub 2023-07-17 20:41:57 +02:00
LinuxSquare
5dbb44b071 Fix menuentry state in bootloader.sls 10 2023-07-16 21:43:24 +02:00
LinuxSquare
30fb007f67 Fix menuentry state in bootloader.sls 9 2023-07-16 21:37:55 +02:00
LinuxSquare
6b990c0c13 Fix menuentry state in bootloader.sls 8 2023-07-16 21:33:59 +02:00
LinuxSquare
62f44a1467 Fix menuentry state in bootloader.sls 7 2023-07-16 21:31:10 +02:00
LinuxSquare
4fa3f90b3c Fix menuentry state in bootloader.sls 6 2023-07-16 21:27:51 +02:00
LinuxSquare
dbb821ebec Fix menuentry state in bootloader.sls 5 2023-07-16 21:21:41 +02:00
LinuxSquare
496dbfa78d Fix menuentry state in bootloader.sls 4 2023-07-16 21:17:22 +02:00
LinuxSquare
e134269eb4 Fix menuentry state in bootloader.sls 3 2023-07-16 20:51:51 +02:00
LinuxSquare
5e0a60b670 Fix menuentry state in bootloader.sls 2023-07-16 20:49:06 +02:00
LinuxSquare
d2b5bb8c80 Fix menuentry state in bootloader.sls 2023-07-16 20:31:26 +02:00
LinuxSquare
bb9bff45d2 Fix menuentry state in bootloader.sls 2023-07-16 20:27:11 +02:00
LinuxSquare
e1e2b0cb77 Fix variable in bootloader.sls 2023-07-16 20:23:05 +02:00
LinuxSquare
c723fb437b try to add custom menuentry 2023-07-16 20:18:31 +02:00
LinuxSquare
481ba3610e Try to fix cmdline 2023-07-16 18:20:35 +02:00
LinuxSquare
d348e66c11 Try to fix cmdline 2023-07-16 18:15:40 +02:00
LinuxSquare
0c7bc4b9aa Add grub-dir in bootloader 2023-07-16 17:38:41 +02:00
LinuxSquare
eecb262bb0 Fix bootloader.sls TIMESTAMP grep 2023-07-16 16:51:42 +02:00
LinuxSquare
b2059ab35e Add bootloader.sls to init 2023-07-16 16:35:59 +02:00
LinuxSquare
a517390dd6 Fix states 2 2023-07-16 16:03:52 +02:00
LinuxSquare
ac8223fd28 Fix states 2023-07-16 15:53:42 +02:00
LinuxSquare
00ef89f319 Add cmdline 2023-07-14 22:10:45 +02:00
LinuxSquare
d4e2253ea3 Stuff 2023-07-14 20:38:09 +02:00
LinuxSquare
dedc587d54 More Code Format 2023-07-12 21:42:28 +02:00
LinuxSquare
43c5e34ab6 Format Code 2023-07-12 21:41:46 +02:00
LinuxSquare
290bd13b97 Fix https-port 2023-07-12 21:36:43 +02:00
LinuxSquare
3e954ef23b Change README 2023-07-12 21:36:12 +02:00
LinuxSquare
63872a229f Major changes - compatible with Alpine 2023-07-12 21:34:09 +02:00
65 changed files with 1231 additions and 150 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
serverspecific.sls
system/files/systemupdate.sh

View file

@ -1,9 +0,0 @@
# Noveria Salt-State
![SaltStack® Logo](https://upload.wikimedia.org/wikipedia/commons/6/64/SaltStack_logo_blk_2k.png)
This repository is for the master-less salt-statetree for the noveria host, running Fedora Server (insert latest version here).
It managed the complete system using the saltproject.
For further instructions, head to the official salt docs: https://docs.saltproject.io/en/latest/contents.html

View file

@ -0,0 +1,25 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
apps_generate-motd_git:
git.latest:
- name: https://git.noveria.org/Tools/generate_motd.git
- target: {{ noveria.app_dir }}/generate_motd
- user: root
- force_reset: True
- require:
- directories_apps_dir
apps_generate-motd_link:
file.symlink:
- name: {{ noveria.bin_dir }}/generate_motd
- target: {{ noveria.app_dir }}/generate_motd/generate_motd
- user: root
- group: root
- mode: '0755'
- require:
- apps_generate-motd_git
- directories_bin_dir
- directories_apps_dir

3
apps/init.sls Normal file
View file

@ -0,0 +1,3 @@
include:
- .noveriablcgen
- .generate-motd

View file

@ -0,0 +1,7 @@
{
"be_env_dir": "{{ BTRFS_ROOT }}",
"grub_conf_dir": "{{ GRUB_CONFD }}",
"filename": "{{ GRUB_CONFIG_FILENAME }}",
"root_uuid": "{{ ROOT_UUID }}",
"grub_cfg": "{{ GRUB_CONFIG }}"
}

View file

@ -0,0 +1,44 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
apps_noveriablcgen_git:
git.latest:
- name: https://git.noveria.org/Tools/noveriablcgen.git
- target: {{ noveria.app_dir }}/noveriablcgen
- user: root
- force_reset: True
- require:
- directories_apps_dir
apps_noveriablcgen_link:
file.symlink:
- name: {{ noveria.bin_dir }}/noveriablcgen
- target: {{ noveria.app_dir }}/noveriablcgen/noveriablcgen
- user: root
- group: root
- mode: '0755'
- require:
- apps_noveriablcgen_git
- directories_bin_dir
- directories_apps_dir
apps_noveriablcgen_config:
file.managed:
- name: {{ noveria.etc_dir }}/noveriablcgen/noveriablcgen.json
- source: salt://{{ tpldir }}/files/noveriablcgen_config.json.jinja
- template: jinja
- context:
BTRFS_ROOT: "/btrfs"
GRUB_CONFD: "/etc/grub.d"
GRUB_CONFIG_FILENAME: "10_noveria"
ROOT_UUID: {{ salt['cmd.shell']('lsblk -o LABEL,UUID | grep ROOT | awk \'{print $2}\'') }}
GRUB_CONFIG: "/boot/grub/grub.cfg"
- mode: '0644'
- makedirs: True
- user: root
- group: root
- require:
- apps_noveriablcgen_git
- directories_etc_dir

39
directories.sls Normal file
View file

@ -0,0 +1,39 @@
{% from "map.jinja" import noveria with context %}
directories_dir:
file.directory:
- name: {{ noveria.dir }}
- user: root
- group: root
- file_mode: '0644'
- dir_mode: '0755'
directories_bin_dir:
file.directory:
- name: {{ noveria.bin_dir }}
- user: root
- group: root
- file_mode: '0644'
- dir_mode: '0755'
- require:
- directories_dir
directories_etc_dir:
file.directory:
- name: {{ noveria.etc_dir }}
- user: root
- group: root
- file_mode: '0644'
- dir_mode: '0755'
- require:
- directories_dir
directories_apps_dir:
file.directory:
- name: {{ noveria.app_dir }}
- user: root
- group: root
- file_mode: '0644'
- dir_mode: '0755'
- require:
- directories_dir

View file

@ -0,0 +1,40 @@
global
log 127.0.0.1 local2
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
timeout queue 1m
timeout connect 10s
timeout client 5m
timeout server 5m
maxconn 3000
frontend ssh
mode tcp
bind {{ ipv4 }}:22
default_backend host-ssh
frontend http
mode tcp
bind {{ ipv4 }}:80
default_backend host-http
backend host-ssh
mode tcp
server localhost 127.0.0.1
backend host-http
mode tcp
server localhost 127.0.0.1

View file

@ -0,0 +1,56 @@
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1,v 1.2 2011/12/04 10:32:32 swegener Exp $
# This is file is managed by salt (state: {{ sls }})
extra_commands="checkconfig"
extra_started_commands="reload"
command=/usr/sbin/haproxy
CONF=${HAPROXY_CONF:-/etc/haproxy/${SVCNAME}.cfg}
CONF_DIR=${HAPROXY_CONF_DIR:-{{ conf_dir }}}
PIDFILE=/var/run/${SVCNAME}.pid
depend() {
need net
after firewall
use dns logger
}
checkconfig() {
if [ ! -f "${CONF}" ] && [ ! -d "${CONF}" ]; then
eerror "${CONF} does not exist!"
return 1
fi
ebegin "Checking ${CONF}"
$command -q -c -f "${CONF}"
eend $?
}
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --pidfile "${PIDFILE}" --exec $command \
--start -- -D -p "${PIDFILE}" -f "${CONF}" -f "${CONF_DIR}"
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
if [ "${RC_CMD}" = "restart" ]; then
checkconfig || return 1
fi
start-stop-daemon --stop --pidfile "${PIDFILE}"
eend $?
}
reload() {
ebegin "Reloading ${SVCNAME}"
checkconfig || { eerror "Reloading failed, please fix your ${CONF} first"; return 1; }
$command -D -p "${PIDFILE}" -f "${CONF}" -f "${CONF_DIR}" -sf $(cat "${PIDFILE}")
eend $?
}

3
haproxy/init.sls Normal file
View file

@ -0,0 +1,3 @@
include:
- .pkg
- .service

5
haproxy/map.jinja Normal file
View file

@ -0,0 +1,5 @@
{% set dir = '/etc/haproxy' %}
{% set haproxy = {
'conf_dir': '%s/conf.d' % dir,
}%}

45
haproxy/pkg.sls Normal file
View file

@ -0,0 +1,45 @@
{% from tpldir+"/map.jinja" import haproxy with context %}
{% set ipv4 = grains['ip4_interfaces']['eth0'][0] %}
haproxy_pkg_pkgs:
pkg.installed:
- pkgs:
- haproxy
haproxy_pkg_conf_dir:
file.directory:
- name: /etc/haproxy/conf.d
- user: root
- group: root
- file_mode: '0644'
- dir_mode: '0755'
- require:
- haproxy_pkg_pkgs
haproxy_pkg_config:
file.managed:
- name: /etc/haproxy/haproxy.cfg
- source: salt://{{ tpldir }}/files/haproxy_config.jinja
- template: jinja
- context:
ipv4: {{ ipv4 }}
- user: root
- group: root
- mode: '0644'
- require:
- haproxy_pkg_pkgs
haproxy_pkg_rc_script:
file.managed:
- name: /etc/init.d/haproxy
- source: salt://{{ tpldir }}/files/haproxy_rcscript.initd.jinja
- template: jinja
- context:
sls: {{ sls }}
conf_dir: {{ haproxy.conf_dir }}
- user: root
- group: root
- mode: '0755'
- require:
- haproxy_pkg_conf_dir
- haproxy_pkg_config

9
haproxy/service.sls Normal file
View file

@ -0,0 +1,9 @@
include:
- .pkg
haproxy_service_running:
service.running:
- name: haproxy
- enable: True
- require:
- haproxy_pkg_rc_script

8
map.jinja Normal file
View file

@ -0,0 +1,8 @@
{% set dir = '/usr/local/noveria' %}
{% set noveria = {
'dir': '%s' % dir,
'bin_dir': '%s/bin' % dir,
'etc_dir': '%s/etc' % dir,
'app_dir': '%s/apps' % dir
} %}

15
mysql/directory.sls Normal file
View file

@ -0,0 +1,15 @@
include:
- .pkg
mysql_directory:
file.directory:
- name: /var/lib/mysql
- create: False
- replace: False
- user: mysql
- group: mysql
- recurse:
- user
- group
- require:
- mysql_pkg

4
mysql/init.sls Normal file
View file

@ -0,0 +1,4 @@
include:
- .pkg
- .directory
- .service

6
mysql/pkg.sls Normal file
View file

@ -0,0 +1,6 @@
mysql_pkg:
pkg.installed:
- pkgs:
- mariadb
- mariadb-client
- mariadb-openrc

18
mysql/service.sls Normal file
View file

@ -0,0 +1,18 @@
include:
- .directory
{% if not salt['file.directory_exists']('/var/lib/mysql/mysql') %}
mysql_service_setup:
cmd.run:
- name: /etc/init.d/mariadb setup
- runas: root
- shell: /bin/ash
- require:
- mysql_directory
mysql_service_enable:
service.enabled:
- name: mariadb
- require:
- mysql_service_setup
{% endif %}

View file

@ -0,0 +1,11 @@
## This file is managed by Saltstack. (state: {{ sls }})
#!/usr/sbin/nft
table inet filter {
chain input {
tcp dport 22 accept
{%- for port in ALLOWED_PORTS %}
tcp dport {{ port }} accept
{%- endfor %}
}
}

View file

@ -0,0 +1,8 @@
auto eth0
iface eth0 inet dhcp
auto lo
iface lo inet loopback
iface lo inet static
address 127.0.0.2/8
broadcast 0.0.0.0

29
network/firewall.sls Normal file
View file

@ -0,0 +1,29 @@
network_firewall_pkgs:
pkg.installed:
- pkgs:
- nftables
network_firewall_rules:
file.managed:
- name: /etc/nftables.d/noveria.nft
- source: salt://{{ tpldir }}/files/firewall_rules.nft.jinja
- template: jinja
- context:
sls: {{ sls }}
ALLOWED_PORTS: [80, 443, 25565, 51871]
- user: root
- group: root
- mode: '0600'
- makedirs: True
- require:
- network_firewall_pkgs
network_firewall_service_reload:
service.running:
- name: nftables
- enable: True
- watch:
- network_firewall_rules
- require:
- network_firewall_pkgs

20
network/init.sls Normal file
View file

@ -0,0 +1,20 @@
include:
- system.base
- .firewall
network_interfaces:
file.managed:
- name: /etc/network/interfaces
- source: salt://{{ tpldir }}/files/network_interfaces
- user: root
- group: root
- mode: '0644'
- require:
- system_base_pkgs
network_service_reload:
service.running:
- name: networking
- enable: True
- watch:
- network_interfaces

17
openssh/config.sls Normal file
View file

@ -0,0 +1,17 @@
include:
- .pkg
openssh_config_configuration:
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://{{ tpldir }}/files/openssh_sshd_config
openssh_config_keys:
file.managed:
- name: /root/.ssh/authorized_keys
- source: salt://{{ tpldir }}/files/openssh_authorized_keys
- makedirs: True
- user: root
- group: root
- require:
- openssh_pkg

View file

@ -18,9 +18,9 @@ Include /etc/ssh/sshd_config.d/*.conf
# SELinux about this change. # SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
# #
#Port 22 Port 22
#AddressFamily any #AddressFamily any
#ListenAddress 0.0.0.0 ListenAddress 127.0.0.1
#ListenAddress :: #ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_rsa_key

4
openssh/init.sls Normal file
View file

@ -0,0 +1,4 @@
include:
- .pkg
- .config
- .service

4
openssh/pkg.sls Normal file
View file

@ -0,0 +1,4 @@
openssh_pkg:
pkg.installed:
- pkgs:
- openssh-server

13
openssh/service.sls Normal file
View file

@ -0,0 +1,13 @@
include:
- .config
openssh_service_enable:
service.running:
- name: sshd
- enable: True
- watch:
- openssh_config_configuration
- openssh_config_keys
- require:
- openssh_config_configuration
- openssh_config_keys

View file

@ -0,0 +1,4 @@
{% from "map.jinja" import noveria with context %}
include:
- directories

3
podman/apps/init.sls Normal file
View file

@ -0,0 +1,3 @@
include:
- .poddoc
- .pms-cli

View file

@ -0,0 +1,11 @@
{
"PODMAN_DIRECTORY": "{{ PODMAN_DIR }}",
"SERVERRUNNERS": {
"paper": "https://api.papermc.io/v2/projects/paper",
"folia": "https://api.papermc.io/v2/projects/folia"
},
"PROXYRUNNERS": {
"waterfall": "https://api.papermc.io/v2/projects/waterfall",
"velocity": "https://api.papermc.io/v2/projects/velocity"
}
}

View file

@ -0,0 +1,40 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
podman_apps_pms-cli_git:
git.latest:
- name: https://git.noveria.org/Tools/pms-cli.git
- target: {{ noveria.app_dir }}/pms-cli
- user: root
- force_reset: True
- require:
- directories_apps_dir
podman_apps_pms-cli_link:
file.symlink:
- name: {{ noveria.bin_dir }}/pms-cli
- target: {{ noveria.app_dir }}/pms-cli/pms-cli
- user: root
- group: root
- mode: '0755'
- require:
- podman_apps_pms-cli_git
- directories_bin_dir
- directories_apps_dir
podman_apps_pms-cli_config:
file.managed:
- name: {{ noveria.etc_dir }}/pms-cli/pms-cli.json
- source: salt://{{ tpldir }}/files/pms-cli_config.json.jinja
- template: jinja
- context:
PODMAN_DIR: "/opt/podman"
- mode: '0644'
- makedirs: True
- user: root
- group: root
- require:
- podman_apps_pms-cli_git
- directories_etc_dir

View file

@ -0,0 +1,4 @@
{
"GIT_REPOSITORY": "{{ GIT_REPO }}",
"PODMAN_DIRECTORY": "{{ PODMAN_DIR }}"
}

View file

@ -0,0 +1,41 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
podman_apps_poddoc_git:
git.latest:
- name: https://git.noveria.org/Tools/poddoc.git
- target: {{ noveria.app_dir }}/poddoc
- user: root
- force_reset: True
- require:
- directories_apps_dir
podman_apps_poddoc_link:
file.symlink:
- name: {{ noveria.bin_dir }}/poddoc
- target: {{ noveria.app_dir }}/poddoc/poddoc
- user: root
- group: root
- mode: '0755'
- require:
- podman_apps_poddoc_git
- directories_bin_dir
- directories_apps_dir
podman_apps_poddoc_config:
file.managed:
- name: {{ noveria.etc_dir }}/poddoc/poddoc.json
- source: salt://{{ tpldir }}/files/poddoc_config.json.jinja
- template: jinja
- context:
GIT_REPO: "https://git.noveria.org/Podman"
PODMAN_DIR: "/opt/podman"
- mode: '0644'
- makedirs: True
- user: root
- group: root
- require:
- podman_apps_poddoc_git
- directories_etc_dir

12
podman/directory.sls Normal file
View file

@ -0,0 +1,12 @@
include:
- .user
podman_directory_permissions:
file.directory:
- name: /opt/podman
- user: puser
- group: puser
- dir_mode: '0755'
- file_mode: '0644'
- require:
- podman_user_puser

View file

@ -0,0 +1 @@
net.ipv4.ip_unprivileged_port_start=0

6
podman/init.sls Normal file
View file

@ -0,0 +1,6 @@
include:
- .pkg
- .rootless
- .user
- .directory
- .service

6
podman/pkg.sls Normal file
View file

@ -0,0 +1,6 @@
podman_pkg:
pkg.installed:
- pkgs:
- podman
- podman-openrc
- podman-compose

45
podman/rootless.sls Normal file
View file

@ -0,0 +1,45 @@
include:
- .pkg
- .user
podman_rootless_cgroup_mode:
file.keyvalue:
- name: /etc/rc.conf
- key_values:
rc_cgroup_mode: '"unified"'
- separator: '='
- uncomment: '#'
- key_ignore_case: false
- value_ignore_case: false
- append_if_not_found: True
- require:
- podman_pkg
podman_rootless_cgroups:
service.running:
- name: cgroups
- enable: True
- watch:
- podman_rootless_cgroup_mode
podman_rootless_modules:
file.append:
- name: /etc/modules
- text:
- tun
- fuse
- ip_tables
podman_rootless_subgid:
file.append:
- name: /etc/subgid
- text: puser:100000:65536
- require:
- podman_user_puser
podman_rootless_subuid:
file.append:
- name: /etc/subuid
- text: puser:100000:65536
- require:
- podman_user_puser

15
podman/service.sls Normal file
View file

@ -0,0 +1,15 @@
include:
- .rootless
podman_service:
service.running:
- name: podman
- enable: True
podman_service_unprivileged_ports:
file.managed:
- name: /etc/sysctl.d/podman.conf
- source: salt://{{ tpldir }}/files/files_unprivileged_ports
- user: root
- group: root
- mode: '0644'

25
podman/user.sls Normal file
View file

@ -0,0 +1,25 @@
include:
- .pkg
podman_user_puser:
user.present:
- name: puser
- uid: 2000
- shell: /bin/zsh
- home: /home/puser
- password: '*'
- hash_password: True
- usergroup: True
- createhome: True
- require:
- podman_pkg
podman_user_openssh_keys:
file.managed:
- name: /home/puser/.ssh/authorized_keys
- source: salt:///openssh/files/openssh_authorized_keys
- makedirs: True
- user: puser
- group: puser
- require:
- podman_user_puser

View file

@ -1,4 +0,0 @@
file_client: local
file_roots:
base:
- /srv/salt/salt-statetree

View file

@ -1,5 +0,0 @@
include:
- .mysql
- .podman
- .ssh
- .salt

View file

@ -1,19 +0,0 @@
include:
- system.packages
system_service_mysql_enable:
service.enabled:
- name: mariadb
- require:
- system_packages_install
file.directory:
- name: /var/lib/mysql
- create: False
- replace: False
- user: mysql
- group: mysql
- recurse:
- user
- group
- require:
- system_packages_install

View file

@ -1,8 +0,0 @@
include:
- system.packages
system_service_podman_enable:
service.enabled:
- name: podman
- require:
- system_packages_install

View file

@ -1,12 +0,0 @@
include:
- system.packages
services_salt_file_client_local:
file.managed:
- name: /etc/salt/minion.d/noveria.conf
- source: salt://{{ tpldir }}/files/salt_noveria.conf
- user: root
- group: root
- mode: 640
- require:
- system_packages_install

View file

@ -1,28 +0,0 @@
include:
- system.packages
system_ssh_add_keys:
file.managed:
- name: /root/.ssh/authorized_keys
- source: salt://{{ tpldir }}/files/ssh_authorized_keys
- makedirs: True
- user: root
- group: root
- require:
- system_packages_install
system_ssh_configuration:
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://{{ tpldir }}/files/ssh_sshd_config
system_ssh_enable:
service.running:
- name: sshd
- enable: True
- watch:
- system_ssh_configuration
- system_ssh_add_keys
- require:
- system_ssh_configuration
- system_ssh_add_keys

74
system/base.sls Normal file
View file

@ -0,0 +1,74 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
system_base_pkgs:
pkg.installed:
- pkgs:
- linux-lts
- linux-firmware-none
- openjdk17-jre-headless
- jq
- vim
- git
- findmnt
- util-linux
- sudo
- curl
- rsync
- screen
system_base_systemupdate:
file.managed:
- name: {{ noveria.app_dir }}/systemupdate
- source: salt://{{ tpldir }}/files/base_systemupdate
- mode: '0755'
- user: root
- group: root
- require:
- directories_apps_dir
system_base_systemupdate_link:
file.symlink:
- name: {{ noveria.bin_dir }}/systemupdate
- target: {{ noveria.app_dir }}/systemupdate
- user: root
- group: root
- mode: '0755'
- require:
- system_base_systemupdate
- directories_bin_dir
system_base_modules_service:
service.running:
- name: modules
- enable: True
# TUN permission fix service workaround
system_base_tun-perm_service:
file.managed:
- name: /etc/init.d/tun-perm
- source: salt://{{ tpldir }}/files/base_tun-perm.initd
- user: root
- group: root
- mode: '0755'
service.enabled:
- name: tun-perm
- require:
- system_base_modules_service
system_base_sysctl_service:
service.running:
- name: sysctl
- enable: True
system_base_syslog_service:
service.running:
- name: syslog
- enable: True
system_base_sysfs_service:
service.running:
- name: sysfs
- enable: True

79
system/bootloader.sls Normal file
View file

@ -0,0 +1,79 @@
include:
- .base
system_bootloader_pkgs:
pkg.installed:
- pkgs:
- grub
- grub-efi
- mkinitfs
- mkinitfs-doc
- efibootmgr
{% set CURRENT_SUBVOLUME_TIMESTAMP = salt['cmd.shell']('CURRENT_SUBVOLUME=$(LC_ALL=C btrfs sub show / | LC_ALL=C grep Name: | tr -d \'[:space:]\'); TIMESTAMP_FORMAT=\'[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}_[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{2}\'; echo "$CURRENT_SUBVOLUME" | grep -Eo "$TIMESTAMP_FORMAT"') %}
{% set CURRENT_SUBVOLUME_TIMESTAMP_HUMAN = salt['cmd.shell']('CURRENT_SUBVOLUME_TIMESTAMP=\'' + CURRENT_SUBVOLUME_TIMESTAMP + '\'; echo "${CURRENT_SUBVOLUME_TIMESTAMP:0:10} ${CURRENT_SUBVOLUME_TIMESTAMP:11:2}:${CURRENT_SUBVOLUME_TIMESTAMP:14:2}"') %}
{% set KERNEL_VERSION = salt['cmd.shell']('uname -r') %}
system_bootloader_mkinitfs_conf:
file.keyvalue:
- name: /etc/mkinitfs/mkinitfs.conf
- key_values:
features: '"ata base btrfs keymap kms mmc nvme scsi usb virtio"'
- separator: '='
- uncomment: '# '
- key_ignore_case: false
- value_ignore_case: false
- append_if_not_found: True
- require:
- system_base_pkgs
- system_bootloader_pkgs
system_bootloader_os-release:
file.managed:
- name: /etc/os-release
- source: salt://{{ tpldir }}/files/bootloader_os-release.jinja
- template: jinja
- context:
OS_VERSION: {{ salt['cmd.shell']('date "+%Y%m"') }}
OS_RELEASE_INFO: '"Timestamp: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }} | Kernel: {{ KERNEL_VERSION }}"'
- user: root
- group: root
- mode: '0644'
system_bootloader_motd_dir:
file.directory:
- name: /etc/motd.d
- user: root
- group: root
- dir_mode: '0755'
- file_mode: '0644'
- require:
- system_bootloader_os-release
system_bootloader_motd:
file.managed:
- name: /etc/motd.d/00_noveria.motd
- source: salt://{{ tpldir }}/files/bootloader_00_noveria.motd.jinja
- template: jinja
- context:
OS_NAME: {{ salt['cmd.shell']('echo NoveriaOS $(date "+%Y%m")') }}
OS_RELEASE_INFO: 'Timestamp: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }} | Kernel: {{ KERNEL_VERSION }}'
OS_ISSUE_URL: 'https://git.noveria.org/NoveriaOS/ISO/issues'
- user: root
- group: root
- mode: '0644'
- require:
- system_bootloader_os-release
- system_bootloader_motd_dir
system_bootloader_issue:
file.managed:
- name: /etc/issue
- source: salt://{{ tpldir }}/files/bootloader_issue.jinja
- template: jinja
- context:
OS_NAME: {{ salt['cmd.shell']('echo NoveriaOS $(date "+%Y%m")') }}
OS_RELEASE_INFO: {{ CURRENT_SUBVOLUME_TIMESTAMP_HUMAN }}
- user: root
- group: root
- mode: '0644'

View file

@ -1,20 +0,0 @@
system_btrfs_create_podman_data_dir:
cmd.run:
- creates: /opt/podman
- name: btrfs subvolume create /opt/podman
file.managed:
- name: /opt/podman
- create: False
- replace: False
- user: root
- group: root
system_btrfs_create_noveria_home:
cmd.run:
- creates: /home/noveria
- name: btrfs subvolume create /home/noveria
system_btrfs_create_mysql_data_dir:
cmd.run:
- creates: /var/lib/mysql
- name: btrfs subvolume create /var/lib/mysql

37
system/disks.sls Normal file
View file

@ -0,0 +1,37 @@
system_disks_pkgs:
pkg.installed:
- pkgs:
- btrfs-progs
system_disks_btrfs_module:
file.append:
- name: /etc/modules
- text: "btrfs"
- require:
- system_base_pkgs
system_disks_btrfs_mount_permission:
file.directory:
- name: /btrfs
- user: root
- group: root
- dir_mode: '0755'
{% set ROOT_UUID = salt['cmd.shell']('lsblk -o LABEL,UUID | grep ROOT | awk \'{print $2}\'') %}
{% set ESP_UUID = salt['cmd.shell']('lsblk -o LABEL,UUID | grep EFI | awk \'{print $2}\'') %}
system_disks_fstab:
file.managed:
- name: /etc/fstab
- source: salt://{{ tpldir }}/files/disks_fstab.jinja
- template: jinja
- context:
TIMESTAMP: {{ salt.pillar.get('system.disks.timestamp') }}
TMPFS_SIZE: {{ salt.pillar.get('system.disks.tmpfs.size') }}
ROOT_UUID: {{ ROOT_UUID }}
ESP_UUID: {{ ESP_UUID }}
- user: root
- group: root
- mode: '0644'
- require:
- system_disks_btrfs_mount_permission

View file

@ -0,0 +1,205 @@
#!/usr/bin/env bash
#######################################################################################################################
##
## Script to full update the system
##
## 0. Pre checks
## 1. Generate new boot environment (BE)
## 2. Update and Salt highstate
## 3. Clean up
##
#######################################################################################################################
#######################################################################################################################
## Definitions
#######################################################################################################################
readonly TEMPDIR=$(mktemp -d /tmp/systemupdate.XXXXXX)
readonly LOCK_FILE="${TEMPDIR}/systemupdate.lock"
readonly TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
readonly BTRFS_ROOT="/btrfs"
readonly CURRENT_SUBVOLUME=$(LC_ALL=C btrfs sub show / | LC_ALL=C grep 'Name' | cut -d: -f2 | awk '{$1=$1};1')
readonly NEW_SUBVOLUME="@root_${TIMESTAMP}"
readonly MOUNTPOINT='/mnt'
readonly EFI_DISK=$(findmnt -T /efi -o SOURCE | tail -n 1)
readonly ROOT_DISK=$(findmnt / -o SOURCE | cut -d"[" -f1 | tail -n 1)
readonly BE_HISTORY_COUNT=5
#######################################################################################################################
## Errorhandling
#######################################################################################################################
#----------------------------------------------------------------------------------------------------------------------
# systemupdate failed
#----------------------------------------------------------------------------------------------------------------------
systemupdateFailed() {
echo ""
echo "┌──────────────────────────────────────────┐"
echo "│ FAILED => clean up │"
echo "└──────────────────────────────────────────┘"
subtaskTitle "Unmount BE if mounted"
unmountMountpoint
subtaskTitle "Remove BE"
removeBEFromTimestamp ${TIMESTAMP}
rm -f ${LOCK_FILE}
subtaskTitle "Finished with exit code 1"
exit 1
}
# catch ^C and other signals and clean up
trap "echo -e '\n=> Interrupted with CTRL+C' >&2; systemupdateFailed" SIGINT SIGHUP SIGTERM SIGABRT
#######################################################################################################################
## Helper Functions
#######################################################################################################################
#----------------------------------------------------------------------------------------------------------------------
# Subtask title output
#----------------------------------------------------------------------------------------------------------------------
subtaskTitle() {
echo -e "\n=> $1"
}
#----------------------------------------------------------------------------------------------------------------------
# Unmount ${MOUNTPOINT}
#----------------------------------------------------------------------------------------------------------------------
unmountMountpoint() {
# if mountpoint exists -> umount
[[ $(findmnt -M "${MOUNTPOINT}") ]] && umount -R "${MOUNTPOINT}"
}
#----------------------------------------------------------------------------------------------------------------------
# Recursive subvolume delete
#----------------------------------------------------------------------------------------------------------------------
btrfsSubDelRecursive() {
btrfs sub list -o "${BTRFS_ROOT}/${1}" | cut -d " " -f 9 | while read i; do
btrfsSubDelRecursive "$i"
done
btrfs sub del "${BTRFS_ROOT}/${1}"
}
#----------------------------------------------------------------------------------------------------------------------
# Remove BE from timestamp
#----------------------------------------------------------------------------------------------------------------------
removeBEFromTimestamp() {
# remove all subvolume with this timestamp
for f in $(btrfs sub list -o /btrfs | cut -d " " -f 9 | grep "@root"); do
if [[ "$f" =~ "$1" ]]; then
btrfsSubDelRecursive "$f"
fi
done
}
#######################################################################################################################
## Main
#######################################################################################################################
echo "┌──────────────────────────────────────────┐"
echo "│ 0. Pre checks │"
echo "└──────────────────────────────────────────┘"
subtaskTitle "Check if another systemupgrade is in progress"
if [ -f ${LOCK_FILE} ]; then
echo "[ERROR] Another systemupgrade is in progress (lockfile: ${LOCK_FILE}) => exit" >&2
exit 1
fi
subtaskTitle "Check if ${MOUNTPOINT} exists"
if [ ! -d ${MOUNTPOINT} ]; then
mkdir -p "${MOUNTPOINT}"
fi
subtaskTitle "Check if ${MOUNTPOINT} is already a mountpoint"
if [[ $(findmnt -M "${MOUNTPOINT}") ]]; then
echo "[ERROR] ${MOUNTPOINT} is already a mountpoint => exit" >&2
exit 1
fi
subtaskTitle "Checks finished and update can start"
# Create lock file
touch ${LOCK_FILE} || systemupdateFailed
echo ""
echo "┌──────────────────────────────────────────┐"
echo "│ 1. Generate new boot environment (BE) │"
echo "└──────────────────────────────────────────┘"
subtaskTitle "Create snapshot of current running system"
btrfs subvolume snapshot / ${BTRFS_ROOT}/${NEW_SUBVOLUME} || systemupdateFailed
subtaskTitle "Mount new BE to ${MOUNTPOINT}"
mount -o noatime,nodiratime,discard=async,space_cache=v2,subvol="${NEW_SUBVOLUME}" "${ROOT_DISK}" "${MOUNTPOINT}" || systemupdateFailed
mount -o noatime,nodiratime,discard=async,space_cache=v2,subvol=@home "${ROOT_DISK}" "${MOUNTPOINT}/home" || systemupdateFailed
mount -o noatime,nodiratime,discard=async,space_cache=v2,subvol=@podman "${ROOT_DISK}" "${MOUNTPOINT}/opt/podman" || systemupdateFailed
mount -o noatime,nodiratime,discard=async,space_cache=v2,subvol=@mysql "${ROOT_DISK}" "${MOUNTPOINT}/var/lib/mysql" || systemupdateFailed
mount -o noatime,nodiratime,discard=async,space_cache=v2,subvol=/ "${ROOT_DISK}" "${MOUNTPOINT}/btrfs" || systemupdateFailed
mount -o nodev,nosuid,noexec "${EFI_DISK}" "${MOUNTPOINT}/efi" || systemupdateFailed
mount -t proc /proc "${MOUNTPOINT}/proc/" || systemupdateFailed
mount -t sysfs /sys "${MOUNTPOINT}/sys/" || systemupdateFailed
mount -o bind /sys/firmware/efi/efivars "${MOUNTPOINT}/sys/firmware/efi/efivars/" || systemupdateFailed
mount -o bind /dev "${MOUNTPOINT}/dev/" || systemupdateFailed
mount -o bind /run "${MOUNTPOINT}/run/" || systemupdateFailed
subtaskTitle "New BE mounted"
echo ""
echo "┌──────────────────────────────────────────┐"
echo "│ 2. Update and Salt highstate │"
echo "└──────────────────────────────────────────┘"
subtaskTitle "Update Saltstack"
chroot "${MOUNTPOINT}" /bin/bash -c "git -C /srv/salt pull" || systemupdateFailed
subtaskTitle "Update bootloader configs"
chroot "${MOUNTPOINT}" /bin/bash -c "salt-call state.sls system.bootloader" >/dev/null || systemupdateFailed
subtaskTitle "Alpine repositories & keyring update"
chroot "${MOUNTPOINT}" /bin/bash -c "apk update" || systemupdateFailed
subtaskTitle "Alpine packages update"
chroot "${MOUNTPOINT}" /bin/bash -c "apk upgrade" || systemupdateFailed
subtaskTitle "Salt highstate"
chroot "${MOUNTPOINT}" /bin/bash -c "salt-call state.highstate" >/dev/null || systemupdateFailed
subtaskTitle "Generate new initial ramdisk"
latest_kernel="$(chroot "${MOUNTPOINT}" /bin/bash -c 'echo $(apk search linux-lts | head -n1 | cut -d- -f3- | sed "s|r||")-lts')"
chroot "${MOUNTPOINT}" /bin/bash -c "mkinitfs $latest_kernel" || systemupdateFailed
subtaskTitle "Update motd"
chroot "${MOUNTPOINT}" /bin/bash -c "/usr/local/noveria/bin/generate_motd" || systemupdateFailed
subtaskTitle "Update GRUB"
chroot "${MOUNTPOINT}" /bin/bash -c "grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=alpine" || systemupdateFailed
chroot "${MOUNTPOINT}" /bin/bash -c "/usr/local/noveria/bin/noveriablcgen --noconfirm" || systemupdateFailed
subtaskTitle "Update finished"
subtaskTitle "Unmount BE"
unmountMountpoint
echo ""
echo "┌──────────────────────────────────────────┐"
echo "│ 3. Clean Up │"
echo "└──────────────────────────────────────────┘"
subtaskTitle "Clean up finished"
# Remove lock file
rm -f ${LOCK_FILE}

View file

@ -0,0 +1,13 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
name="tun module permission setter"
description="setting the permission of /dev/net/tun to 666"
command=$(which chmod)
command_args="0666 /dev/net/tun"
command_user="root"
depend() {
need modules
}

View file

@ -0,0 +1,17 @@
╔═══════════════════════════════════════════════╗
║ Velkommen til ║
║ _ _ _ ║
║ | \ | | (_) ║
║ | \| | _____ _____ _ __ _ __ _ ║
║ | . ` |/ _ \ \ / / _ \ '__| |/ _` | ║
║ | |\ | (_) \ V / __/ | | | (_| | ║
║ |_| \_|\___/ \_/ \___|_| |_|\__,_| ║
║ ║
╚═══════════════════════════════════════════════╝
OS: {{ OS_NAME }}
Version: {{ OS_RELEASE_INFO }}
Report issues on: {{ OS_ISSUE_URL }}
═════════════════════════════════════════════════

View file

@ -0,0 +1,2 @@
Velkommen til {{ OS_NAME }}
Timestamp: {{ OS_RELEASE_INFO }} | Kernel: \r

View file

@ -0,0 +1,8 @@
NAME="NoveriaOS"
ID=noveriaos
ID_LIKE=alpine
VERSION_ID="{{ OS_VERSION }}"
PRETTY_NAME="NoveriaOS {{ OS_VERSION }}"
RELEASE_INFO={{ OS_RELEASE_INFO }}
HOME_URL="https://noveria.org"
BUG_REPORT_URL="https://git.noveria.org/NoveriaOS/ISO/issues"

View file

@ -0,0 +1,11 @@
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
UUID={{ ROOT_UUID }} / btrfs noatime,nodiratime,compress=zstd,ssd,shared,discard=async,space_cache=v2,subvol=/@root_{{ TIMESTAMP }} 0 0
UUID={{ ESP_UUID }} /efi vfat rw,nosuid,nodev,noexec,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
UUID={{ ROOT_UUID }} /home btrfs noatime,nodiratime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=/@home 0 0
UUID={{ ROOT_UUID }} /var/lib/mysql btrfs noatime,nodiratime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=/@mysql 0 0
UUID={{ ROOT_UUID }} /opt/podman btrfs noatime,nodiratime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=/@podman 0 0
UUID={{ ROOT_UUID }} /btrfs btrfs noatime,nodiratime,compress=zstd,ssd,discard=async,space_cache=v2,space_cache=v2,subvol=/ 0 0
tmpfs /tmp tmpfs nodev,nosuid,size={{ TMPFS_SIZE }} 0 0

10
system/files/salt_minion Normal file
View file

@ -0,0 +1,10 @@
---
state_verbose: False
file_client: local
file_roots:
base:
- /srv/salt
pillar_roots:
base:
- /srv/pillar
...

View file

@ -0,0 +1,34 @@
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:{{ CUSTOM_BIN }}"
export PAGER=less
export EDITOR=vim
umask 022
# use nicer PS1 for bash and busybox ash
if [ -n "$BASH_VERSION" -o "$BB_ASH_VERSION" ]; then
PS1='[%n@%m %~]%# '
# use nicer PS1 for zsh
elif [ -n "$ZSH_VERSION" ]; then
PS1='[%n@%m %~]%# '
# set up fallback default PS1
else
: "${HOSTNAME:=$(hostname)}"
PS1='${HOSTNAME%%.*}:$PWD'
[ "$(id -u)" -eq 0 ] && PS1="${PS1}# " || PS1="${PS1}\$ "
fi
if [ -n "$BASH_VERSION" ] && [ "$BASH" != "/bin/sh" ]; then
# if we're bash (and not /bin/sh bash), also source the bashrc
# by default, bash sources the bashrc for non-login,
# and only /etc/profile on login (-l). so, make it do both on login.
# this ensures that login-shell bash (e.g. -bash or bash -l) still sources the
# system bashrc, which e.g. loads bash-completion
. /etc/bash/bashrc
fi
for script in /etc/profile.d/*.sh ; do
if [ -r "$script" ] ; then
. "$script"
fi
done
unset script

View file

@ -1,4 +1,7 @@
include: include:
- .btrfs - .base
- .user - .bootloader
- .packages - .disks
- .user
- .shell
- .salt

View file

@ -1,16 +0,0 @@
include:
- .btrfs
system_packages_install:
pkg.installed:
- pkgs:
- podman
- cockpit-podman
- podman-docker
- podman-compose
- mariadb-server
- java-latest-openjdk-headless
- jq
- require:
- system_btrfs_create_podman_data_dir
- system_btrfs_create_mysql_data_dir

39
system/salt.sls Normal file
View file

@ -0,0 +1,39 @@
include:
- system.base
system_salt_pkg:
pkg.installed:
- pkgs:
- salt-minion
- require:
- system_base_pkgs
system_salt_minion_config:
file.managed:
- name: /etc/salt/minion
- source: salt://{{ tpldir }}/files/salt_minion
- user: root
- group: root
- mode: '0644'
system_salt_minon_service:
service.disabled:
- name: salt-minion
- require:
- system_salt_pkg
system_salt_minion_cachedir_permission:
file.directory:
- name: /var/cache/salt/minion
- mode: '0700'
- require:
- system_salt_pkg
system_salt_minion_logdir_permission:
file.directory:
- name: /var/log/salt
- user: root
- group: root
- mode: '0700'
- require:
- system_salt_pkg

27
system/shell.sls Normal file
View file

@ -0,0 +1,27 @@
{% from "map.jinja" import noveria with context %}
include:
- directories
- system.base
system_shell_pkgs:
pkg.installed:
- pkgs:
- zsh
- alpine-zsh-config
- bash
- require:
- system_base_pkgs
system_shell_profile:
file.managed:
- name: /etc/profile
- source: salt://{{ tpldir }}/files/shell_profile.jinja
- template: jinja
- context:
CUSTOM_BIN: {{ noveria.bin_dir }}
- user: root
- group: root
- mode: '0644'
- require:
- system_shell_pkgs

View file

@ -1,22 +1,12 @@
include: system_user_noveria_create:
- .btrfs user.present:
- name: noveria
- shell: /bin/false
- home: /home/noveria
- usergroup: True
- createhome: True
system_user_create: system_user_root_edit:
user.present: user.present:
- name: noveria - name: root
- shell: /bin/false - shell: /bin/zsh
- home: /home/noveria
- usergroup: True
- createhome: False
system_user_create_home_noveria:
file.directory:
- name: /home/noveria
- user: noveria
- group: noveria
- mode: 700
- recurse:
- user
- group
- require:
- system_btrfs_create_noveria_home

11
top.sls
View file

@ -1,4 +1,9 @@
base: base:
'*': '*':
- system - directories
- services - system
- network
- apps
- openssh
- haproxy
- serverspecific