diff --git a/configs/base.yaml b/configs/base.yaml index 3885be2..3716a3d 100644 --- a/configs/base.yaml +++ b/configs/base.yaml @@ -83,10 +83,21 @@ packages: update: true cleanup: true sets: + # dependencies for otehr stuff - packages: - openssh-client - openssh-server - sudo + - gnupg + - ca-certificates + action: install + + # useful programs + - packages: + - nano + - tree + - curl + - ncdu action: install # for the sshd/login diff --git a/configs/games_wing.yaml b/configs/games_wing.yaml new file mode 100644 index 0000000..3cbf563 --- /dev/null +++ b/configs/games_wing.yaml @@ -0,0 +1,118 @@ +image: + name: debian-disco-x86_64 + distribution: debian + release: bookworm + description: |- + Debian {{ image.release }} + architecture: amd64 + +source: + downloader: rootfs-http + url: file://SKYNET_ROOT_DIR/images/base_trainee/rootfs.tar.xz + +targets: + lxc: + create_message: |- + You just created an {{ image.description }} container. + + To enable SSH, run: apt install openssh-server + No default root or user password are set by LXC. + config: + - type: all + before: 5 + content: |- + lxc.include = LXC_TEMPLATE_CONFIG/debian.common.conf + + - type: user + before: 5 + content: |- + lxc.include = LXC_TEMPLATE_CONFIG/debian.userns.conf + + - type: all + after: 4 + content: |- + lxc.include = LXC_TEMPLATE_CONFIG/common.conf + + - type: user + after: 4 + content: |- + lxc.include = LXC_TEMPLATE_CONFIG/userns.conf + + - type: all + content: |- + lxc.arch = {{ image.architecture_personality }} + +files: +- path: /skynet/wings.service + generator: copy + source: ./files/wings.service + +packages: + manager: apt + update: true + cleanup: true + repositories: + - name: docker.list + url: |- + deb [arch={{ image.architecture }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ image.release }} stable + sets: + - packages: + - docker.io + - docker-doc + - docker-compose + - podman-docker + - containerd + - runc + action: remove + + - packages: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-buildx-plugin + - docker-compose-plugin + action: install + +actions: +# this runs before packages are installed. +- trigger: post-unpack + action: |- + #!/bin/sh + set -eux + + # for dns + cp /etc/resolv.conf /etc/resolv.conf.bak + echo -e "\nnameserver 9.9.9.9" >> /etc/resolv.conf + + # get and set teh key for docker + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + + # reset dns + cp /etc/resolv.conf.bak /etc/resolv.conf + + +- trigger: post-files + action: |- + #!/bin/sh + set -eux + + # for dns + cp /etc/resolv.conf /etc/resolv.conf.bak + echo -e "\nnameserver 9.9.9.9" >> /etc/resolv.conf + + # install the wings + mkdir -p /etc/pterodactyl + curl -L -o /usr/local/bin/wings "https://github.com/pterodactyl/wings/releases/latest/download/wings_linux_$([[ "$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "arm64")" + chmod u+x /usr/local/bin/wings + + # setup config file + cp /skynet/wings.service /etc/systemd/system + + # make sure they run on boot + systemctl enable docker + systemctl enable wings + + # reset dns + cp /etc/resolv.conf.bak /etc/resolv.conf \ No newline at end of file diff --git a/files/wings.service b/files/wings.service new file mode 100644 index 0000000..4ce31e9 --- /dev/null +++ b/files/wings.service @@ -0,0 +1,19 @@ +[Unit] +Description=Pterodactyl Wings Daemon +After=docker.service +Requires=docker.service +PartOf=docker.service + +[Service] +User=root +WorkingDirectory=/etc/pterodactyl +LimitNOFILE=4096 +PIDFile=/var/run/wings/daemon.pid +ExecStart=/usr/local/bin/wings +Restart=on-failure +StartLimitInterval=180 +StartLimitBurst=30 +RestartSec=5s + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/run.sh b/run.sh index a191eca..d1cd96d 100755 --- a/run.sh +++ b/run.sh @@ -49,6 +49,7 @@ function main(){ build base build base_trainee + build games_wing cleanup }