Updated version and README
This commit is contained in:
parent
f4826c5ca9
commit
7743cb8eb6
|
|
@ -1277,7 +1277,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "request-mirror"
|
name = "request-mirror"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel",
|
"diesel",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "request-mirror"
|
name = "request-mirror"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
|
||||||
74
README.md
74
README.md
|
|
@ -6,9 +6,8 @@ This application provides a web ui for sending get/post requests and provides a
|
||||||

|

|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
- Update Readme
|
|
||||||
- Document
|
N/a
|
||||||
- Develop Pipelines
|
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
|
|
@ -51,6 +50,71 @@ Then push the image
|
||||||
docker push raspberrypi99/request-mirror:latest
|
docker push raspberrypi99/request-mirror:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploying to azure
|
## Development Environment
|
||||||
|
|
||||||
TODO
|
During development, you'll want to use a few tools to help work on this project.
|
||||||
|
|
||||||
|
First, you'll want to install docker.
|
||||||
|
|
||||||
|
For environments with a GUI: https://docs.docker.com/desktop/
|
||||||
|
For environments without a GUI: https://docs.docker.com/engine/install/
|
||||||
|
|
||||||
|
You can use docker for many things. This project has a set of files for creating and deploying as a docker container. In order to start development, you'll need a postgres container. By default in the .env file, the rust code will attempt to connect a localhost instance of postgres.
|
||||||
|
|
||||||
|
Use the following command to start a postgres container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --name postgres -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=postgres -e POSTGRES_DB=request_mirror_db -d postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
This will start up an instance of postgres to only localhost. Remote computers can't connect to the database. This setup does not use any volumes, meaning that when the container is removed, the data will be gone. If you'd like to add volumes, you can run the following command instead which maps a new postgres-data volume to /var/lib/postgresql/data.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --name postgres -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=postgres -e POSTGRES_DB=request_mirror_db -v postgres-data:/var/lib/postgresql/data -d postgres:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Now that postgres is running, you can now install rust if you haven't already. Follow the instructions on the following site [rustup.rs](https://rustup.rs/)
|
||||||
|
|
||||||
|
Follow the instructions for installing the stable toolchain for rust. You may need to log in and log out after installation.
|
||||||
|
|
||||||
|
**Notice**: Older versions of request mirror used rocket v0.4.x which required the nightly toolchain, please update your repo/fork.
|
||||||
|
|
||||||
|
Next, we can install [diesel](https://diesel.rs/), an ORM and query builder for rust. This is how we deploy tables to our database. Install diesel cli:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo install diesel_cli --no-default-features --features postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
You can deploy the database with the following command:
|
||||||
|
|
||||||
|
**Notice**: If you are not adding a volume to your postgres database, you may need to re-run this step each time you create the postgres docker container.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
diesel migration run
|
||||||
|
```
|
||||||
|
|
||||||
|
Now that the database is ready and rust is installed, we can move onto running the project.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also run the following to run a release binary
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run --release
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Docker Image and Run Locally
|
||||||
|
|
||||||
|
You can build the docker image by running the following comand
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build . -t raspberrypi99/request-mirror
|
||||||
|
```
|
||||||
|
|
||||||
|
Next, you can run the project using the following command. This can be run even with the development postgres container running. This will open port 80 for the user to connect to.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue