mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-14 02:06:49 +01:00
feat: add systemd installation
This commit is contained in:
12
Makefile
12
Makefile
@@ -10,8 +10,18 @@ build:
|
||||
mkdir -p bin
|
||||
env GOOS=linux GOARCH=${ARCH} go build -o bin/rcond-${ARCH} ./cmd/rcond/main.go
|
||||
|
||||
install:
|
||||
sudo mkdir -p /etc/rcond
|
||||
sudo mkdir -p /var/rcond
|
||||
sudo cp config/rcond.yaml /etc/rcond/config.yaml
|
||||
sudo cp bin/rcond-${ARCH} /usr/local/bin/rcond
|
||||
sudo cp systemd/rcond.service /etc/systemd/system/rcond.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable rcond
|
||||
sudo systemctl start rcond
|
||||
|
||||
run:
|
||||
bin/rcond-${ARCH} -config config.yaml
|
||||
bin/rcond-${ARCH} -config config/rcond.yaml
|
||||
|
||||
dev:
|
||||
RCOND_ADDR=127.0.0.1:8080 \
|
||||
|
||||
59
README.md
59
README.md
@@ -13,6 +13,16 @@ A simple daemon and REST API to manage:
|
||||
- systemd
|
||||
- Linux operating system
|
||||
|
||||
## Installation
|
||||
|
||||
In order to install `rcond`as a systemd service, you need to specify the target architecture and then run the build and install make targets.
|
||||
|
||||
```sh
|
||||
export ARCH=arm64
|
||||
make build
|
||||
make install
|
||||
```
|
||||
|
||||
## Build and Run
|
||||
|
||||
```bash
|
||||
@@ -20,6 +30,34 @@ make build
|
||||
make run
|
||||
```
|
||||
|
||||
## Develop
|
||||
|
||||
```sh
|
||||
make dev
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### File
|
||||
|
||||
The default config file location is `/etc/rcond/config.yaml`.
|
||||
It can be overwritten by environment variables and flags.
|
||||
An full example configuration with comments can be found in `config/rcond.yaml`
|
||||
|
||||
Example configuration:
|
||||
```yaml
|
||||
rcond:
|
||||
addr: 0.0.0.0:8080
|
||||
api_token: 1234567890
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Environment Variable | Description | Default |
|
||||
|----------------------|-----------------------------------------|---------------|
|
||||
| RCOND_ADDR | Address to bind the HTTP server to. | 0.0.0.0:8080 |
|
||||
| RCOND_API_TOKEN | API token to use for authentication. | N/A |
|
||||
|
||||
## API
|
||||
|
||||
The full API specification can be found in [api/rcond.yaml](api/rcond.yaml).
|
||||
@@ -51,27 +89,6 @@ All endpoints except `/health` require authentication via an API token passed in
|
||||
### Request/Response Format
|
||||
All endpoints use JSON for request and response payloads.
|
||||
|
||||
## Configuration
|
||||
|
||||
### File
|
||||
|
||||
The default config file location is `/etc/rcond/config.yaml`.
|
||||
It can be overwritten by environment variables and flags.
|
||||
|
||||
Example configuration:
|
||||
```yaml
|
||||
rcond:
|
||||
addr: 0.0.0.0:8080
|
||||
api_token: 1234567890
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Environment Variable | Description | Default |
|
||||
|----------------------|-----------------------------------------|---------------|
|
||||
| RCOND_ADDR | Address to bind the HTTP server to. | 0.0.0.0:8080 |
|
||||
| RCOND_API_TOKEN | API token to use for authentication. | N/A |
|
||||
|
||||
## Examples
|
||||
|
||||
### Setup an Access Point
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
rcond:
|
||||
addr: 0.0.0.0:8080
|
||||
api_token: 1234567890
|
||||
5
config/rcond.yaml
Normal file
5
config/rcond.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
rcond:
|
||||
# Address to bind the HTTP server to
|
||||
addr: 0.0.0.0:8080
|
||||
# API token to use for authentication
|
||||
api_token: 1234567890
|
||||
@@ -5,8 +5,8 @@ After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/path/to/your/rcond
|
||||
ExecStart=/path/to/your/rcond/bin/rcond-${ARCH} ${ADDR}
|
||||
WorkingDirectory=/var/rcond
|
||||
ExecStart=/usr/local/bin/rcond
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
Reference in New Issue
Block a user