This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add/Dependencies and docs for deployment and installation (#8)
* Add docs, project resources and install deps script * Remove submodule * rm deps * Add deps * Edit readme * Remove mistake from main.go
- Loading branch information
Showing
6 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "hallRequestAssigner"] | ||
path = Project-resources | ||
url = https://github.com/TTK4145/Project-resources.git |
Submodule Project-resources
added at
a1cdf0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,61 @@ | ||
# elevator-project | ||
# Elevator project - TTK4145 | ||
|
||
[](https://github.com/tordnat/elevator-project/actions/workflows/build_go.yml) | ||
Elevator project for Real-time Programming TTK4145 at NTNU. This a distributed program which is designed to handle multiple elevators on a network concurrently in a fail-safe manner. | ||
|
||
Elevator project for Real-time Programming TTK4145 at NTNU | ||
## Cloning the repository | ||
Since we have git submodules you need to clone the repository recursively: | ||
`git clone --recursive link.to.repo.git ` | ||
|
||
## To-do: | ||
- Logging functionality 🤓 | ||
- Printing MORE elevators simul. 🛗🛗🛗🛗 | ||
## Dependencies | ||
|
||
This project requires the following dependencies to be installed on the host machine: | ||
- `elevatorserver` or `elevatorsimulator` needs to be installed and on the path of the root user | ||
- `golang` >= 1.21 For the distributed elevator program | ||
- `dmd` D-lang compiler for the hall request assigner | ||
|
||
Snippets: | ||
`sudo apt install golang` | ||
`sudo apt install dmd` | ||
|
||
You can also use the installation script in the `scripts/` folder in the root directory of this repository: | ||
`chmod +x scripts/install_deps.sh` | ||
|
||
> Note: If DMD is not in apt sources, visit https://dlang.org/download.html for dmd download | ||
## Deployment | ||
|
||
To deploy an instance of an elevator you only need to run: | ||
`sudo ./scripts/create_and_start_elevatorservice.sh 1` | ||
Where the argument specifies the ID of that instance. The script does the following: | ||
- Make a config directory `~/.config/elevator/` | ||
- build the elevator program and copy to `~/.config/elevator/` | ||
- Copy the template systemd service file `[email protected]` to `/etc/systemd/system` | ||
- Start the `elevatorserver` | ||
- Enable and start the service with given ID | ||
|
||
You can use systemctl to stop, start or view the status of a running elevator: | ||
|
||
`sudo systemctl start elevator@1` | ||
|
||
`sudo systemctl stop elevator@1` | ||
|
||
`sudo systemctl status elevator@1` | ||
|
||
## Un-deployment: Removing the elevator | ||
To remove the elvatorservice and it's configuration files you can use the following command: | ||
|
||
`sudo ./scripts/stop_and_remove_elevatorservice.sh 1` | ||
|
||
"1" being the instance you want to remove. | ||
|
||
## Manual deployment | ||
|
||
To deploy the elevator manually you can run the elevatorserver: | ||
|
||
`elevatorserver --port myport` | ||
|
||
and then run the elevator program: | ||
|
||
`go run main.go --id myid --port myport` | ||
|
||
> This is not part of the deployment, but is useful for testing (we use systemd for resetting our system from fail states) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
echo "Installing dependencies" | ||
sudo apt install golang | ||
sudo apt install dmd | ||
|
||
HRA_INSTALL_PATH="elevatorAlgorithm/hra/" | ||
echo "Building project and moving hall_request_assigner to workspace root" | ||
chmod +x Project-resources/cost_fns/hall_request_assigner/build.sh | ||
Project-resources/cost_fns/hall_request_assigner/build.sh | ||
sudo cp Project-resources/cost_fns/hall_request_assigner $HRA_INSTALL_PATH |