Skip to content

Commit

Permalink
NEX CLI rootfs Compatability (#165)
Browse files Browse the repository at this point in the history
* adds `nex rootfs` subcommand
  • Loading branch information
jordan-rash authored Apr 15, 2024
1 parent b6010b9 commit 7bdf0a1
Show file tree
Hide file tree
Showing 17 changed files with 691 additions and 494 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ builds:
- netgo
hooks:
post:
- sudo go run ./agent/fc-image/. {{.Path}}
- sudo go run ./nex/. fs --agent {{.Path}}

archives:
- id: binaries
Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ tasks:
- go build -tags netgo -ldflags '-extldflags "-static"'

rootfs:
dir: agent/fc-image
dir: nex
sources:
- "*.go"
cmds:
- sudo /usr/local/go/bin/go run . ../cmd/nex-agent/nex-agent
- sudo ./nex fs --agent ../agent/cmd/nex-agent/nex-agent
- gunzip rootfs.ext4.gz
deps:
[agent]
[agent, nex]

echo-service:
dir: examples/echoservice
Expand Down
21 changes: 21 additions & 0 deletions _scripts/docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine:3.19.1

ADD alpine-openrc.sh /etc/init.d/agent

RUN apk add --no-cache openrc
RUN apk add --no-cache util-linux

RUN ln -s agetty /etc/init.d/agetty.ttyS0
RUN echo ttyS0 > /etc/securetty
RUN rc-update add agetty.ttyS0 default

RUN echo "root:root" | chpasswd

RUN addgroup -g 1000 -S nex
RUN adduser -u 1000 -S nex -G nex

RUN rc-update add devfs boot
RUN rc-update add procfs boot
RUN rc-update add sysfs boot

RUN rc-update add agent boot
19 changes: 19 additions & 0 deletions _scripts/docker/agent.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=Nex Agent
After=network.target

[Service]
User=nex
Group=nex
ExecStart=/usr/local/bin/agent
KillSignal=SIGINT
StandardOutput=file:/home/user/nex.log
StandardError=file:/home/user/err.log
Type=simple
Restart=always


[Install]
WantedBy=default.target
RequiredBy=network.target

14 changes: 14 additions & 0 deletions _scripts/docker/alpine-openrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/sbin/openrc-run

name=$RC_SVCNAME
description="Nex Agent"
supervisor="supervise-daemon"
command="/usr/local/bin/agent"
pidfile="/run/agent.pid"
command_user="nex:nex"
output_log="/home/nex/nex.log"
error_log="/home/nex/err.log"

depend() {
after net.eth0
}
200 changes: 0 additions & 200 deletions agent/fc-image/rootfs.go

This file was deleted.

50 changes: 0 additions & 50 deletions agent/fc-image/scripts.go

This file was deleted.

Loading

0 comments on commit 7bdf0a1

Please sign in to comment.