From 783ca7fb32d88a48b58223dabc0b40048b99ce94 Mon Sep 17 00:00:00 2001 From: firebadnofire Date: Wed, 17 Apr 2024 13:37:22 -0400 Subject: [PATCH] commit --- Makefile | 33 +++++++++++++++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ rms-server.service | 11 +++++++++++ 3 files changed, 68 insertions(+) create mode 100644 Makefile create mode 100644 rms-server.service diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..30fd881 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +# Variables +BIN_NAME = rms-server +SERVICE_FILE = rms-server.service +BIN_DEST = /usr/local/bin/$(BIN_NAME) +SERVICE_DEST = /etc/systemd/system/$(SERVICE_FILE) + +# Targets +all: + @echo "Usage:" + @echo "" + @echo "make compile: only compile" + @echo "make install_bin: only move the bin to /usr/local/bin" + @echo "make install_service: only install the service file to /etc/systemd/system" + @echo "make install: compile, then install both the service file and bin" + @echo "make uninstall: remove the bin and service file" + +install: compile install_bin install_service + +compile: + cargo build --release + +install_bin: + sudo cp target/release/$(BIN_NAME) $(BIN_DEST) + +install_service: + sudo cp $(SERVICE_FILE) $(SERVICE_DEST) + sudo systemctl daemon-reload + +uninstall: + sudo systemctl stop rms-server + sudo rm -r $(SERVICE_DEST) $(BIN_DEST) target + sudo systemctl daemon-reload + diff --git a/README.md b/README.md index 4d1bdf3..3487094 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,30 @@ Rust Messenger Service - Server +Usage: + +``` +-p PORT: set port + +-l /path/to/dir: set log dir (defaults to /var/log/RMS-server) + +-h: print help info +``` + +## Build instructions: + +Install rust: rust-lang.org/tools/install + +Optional: edit rms-server.service to your liking + +Run make: `make install` + +## Uninstal: + +Run make: `make uninstall` + +## other + Check out: RMS-client diff --git a/rms-server.service b/rms-server.service new file mode 100644 index 0000000..3696138 --- /dev/null +++ b/rms-server.service @@ -0,0 +1,11 @@ +[Unit] +Description=RMS Server +After=network-online.target + +[Service] +Type=simple +User=root +ExecStart=/usr/local/bin/rms-server + +[Install] +WantedBy=multi-user.target