Remade makefile, fixed symlink bug in justfile, simplified servicefile, updated README
This commit is contained in:
@@ -3,80 +3,84 @@
|
||||
## Why?
|
||||
To test my abilities to develop networked programs, and to enhance my skills in writing such.
|
||||
## Requirements
|
||||
|
||||
### Hardware
|
||||
- Client machine
|
||||
- Server machine (not required to be distinct from Client)
|
||||
|
||||
### Software
|
||||
- [Golang]
|
||||
- Linux distro (highly recommened)
|
||||
- ```make``` is also used in this guide, but the makefile is incredibly simple, and can be skipped entirely by running ```go build``` instead
|
||||
- Tested with [golang] v1.26
|
||||
- Installation has only been tested with [just] v1.53
|
||||
- Server installation assumes systemd (tested with v260.2)
|
||||
|
||||
### Installation
|
||||
Golang can be installed on Mac with
|
||||
``` sh
|
||||
brew install golang
|
||||
```
|
||||
Clone the repo
|
||||
``` sh
|
||||
git clone https://github.com/alexander-the-alright/ekho
|
||||
cd ekho
|
||||
```
|
||||
Using your favorite text editor, change the destination IP and Port to whatever works for you. This is defined on line 247 in client.go as 127.0.0.1:1300.
|
||||
|
||||
Now the server file needs to be run on the preferred port, as specified in the client file. This is defined on line 257 in server.go.
|
||||
#### Justfile
|
||||
It is recommended to use ```just``` for installation, as it has more
|
||||
capabilities than ```make```, however, there is a makefile included.
|
||||
To install the server with ```just```, run ```sudo just ins_server```.
|
||||
You will be prompted to enter a new port number to run the server on (
|
||||
or leave blank to use 1300). The port will be changed in the source
|
||||
file before compilation.
|
||||
To install the client with ```just```, run ```sudo just ins_client```.
|
||||
You will be prompted to enter the IP (or URL) and port of the server
|
||||
(or leave blank to use localhost:1300). The IP/URL and port will be
|
||||
changed in the source file before compilation.
|
||||
|
||||
#### Makefile
|
||||
If you are unable or willing to use ```just```, the included makefile
|
||||
still has most of the functionality, but it does not change any
|
||||
important parameters. The following changes are advised before
|
||||
installation.
|
||||
|
||||
The binary(s) can be obtained using the makefile
|
||||
If the server is being run on a separate machine, only run make with client flag
|
||||
``` sh
|
||||
make client
|
||||
```
|
||||
If both binaries are being run on the same machine, ```make all``` will suffice. Although, both of these commands can be bypassed with ```go build```, as this is all ```make``` does anyway.
|
||||
``` sh
|
||||
make all
|
||||
```
|
||||
1. On the client machine, change the IP/URL and port in the client source file. This can be
|
||||
done quickly with ```sed -i -e "s/127.0.0.1:1300/YOUR.IP.GOES.HERE:PORT/" client.go```
|
||||
2. On the server machine, change the port in the server source file. This can be done with a
|
||||
similar command: ```sed -i -e "s/1300/PORT/" server.go```. (note: this
|
||||
should match the port from bullet 1)
|
||||
3. On the server machine, change the user referenced in the systemd service file. This can be
|
||||
done with another sed command, ```sed -e -i "s/USER/YOUR_USERNAME/" ekho.service```
|
||||
|
||||
#### NOTE
|
||||
In previous versions, the suggested method of installation involved placing bash scripts in ```/etc/update-motd.d/```, however, there have been issues getting that installation method working (namely, having MOTD run user-defined commands), and the current quick and extremely dirty suggested installation method is to just append the user's shell config files (```.bashrc```, ```.bash_profile```, ```.zshrc```, etc) with the paths to the executables.
|
||||
After making these changes on the respective machines, run either
|
||||
```sudo make ins_client``` or ```sudo make ins_server``` to compile and install the client
|
||||
and/or server binaries.
|
||||
|
||||
For example, if the server used zsh, the installation could look something like this:
|
||||
``` sh
|
||||
echo "~/abs/path/to/server.o &" >> ~/.zshrc
|
||||
```
|
||||
Similarly for a client using Bash:
|
||||
``` sh
|
||||
echo "~/abs/path/to/client.o" >> ~/.bashrc
|
||||
```
|
||||
|
||||
Any help figuring out the issue with MOTD would be appreciated.
|
||||
#### After Installation
|
||||
After installation of the server binary, systemd will display the
|
||||
status of the new service. It should be ```enabled``` and
|
||||
```running```.
|
||||
|
||||
Finally done!
|
||||
|
||||
### Usage
|
||||
The client uses the following flags
|
||||
``` sh
|
||||
-h - display help message
|
||||
-a <s> - adds required argument <s> as a quote to server
|
||||
-l - list all quotes
|
||||
-r [i] - remove; may be run with or without argument
|
||||
-ip - specify alternate server destination
|
||||
-s - specify the size of the receipt buffer
|
||||
-h - display help message
|
||||
-a <string> - adds required argument <s> as a quote to server
|
||||
-ip <ip:port> - specify alternate server destination
|
||||
-l - list all quotes
|
||||
-r [i] - remove; may be run with or without argument
|
||||
-s <i> - specify the size of the receipt buffer
|
||||
```
|
||||
The server uses the following flags
|
||||
``` sh
|
||||
-h - display help message
|
||||
-s - specify the size of the receipt buffer
|
||||
-s <i> - specify the size of the receipt buffer
|
||||
-v - display version and exit
|
||||
-vv - display version and about info and exit
|
||||
```
|
||||
|
||||
### How It Works
|
||||
The sequence diagram can be viewed in ```diag``` folder, which shows the sequence of networked messages for each usage of ekho.
|
||||
The source code is in the same folder, ```ekho-seq.txt```, and can be uploaded to [sequencediagram.org][seqdiag] to rerender the diagram and view any updates.
|
||||
|
||||
|
||||
### To Be Implemented
|
||||
- Log all uses/transaction data each day
|
||||
- Request, send, and receive the logfile for any day
|
||||
- Request, send, and receive the logfile
|
||||
- User-specific quotes/quotefiles
|
||||
- Installation (client-side, at least) via MOTD
|
||||
|
||||
- Colored printing and coloring quotes
|
||||
- Edit quotes
|
||||
|
||||
[golang]: <https://go.dev/doc/install>
|
||||
[seqdiag]: <sequencediagram.org>
|
||||
[just]: <https://github.com/casey/just>
|
||||
|
||||
Reference in New Issue
Block a user