From 5dde1f55d818a74e838afa37b0e20217b1549a83 Mon Sep 17 00:00:00 2001 From: Melonai Date: Tue, 2 Feb 2021 18:55:38 +0100 Subject: Update README and add an example .env --- .env.example | 3 +++ README.md | 33 ++++++++++++++++----------------- 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..142205c --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +DATABASE_URL=postgres://postgres:@localhost:5432/shorest +POSTGRES_PASSWORD= +PORT= \ No newline at end of file diff --git a/README.md b/README.md index 732efcd..f4c5d96 100644 --- a/README.md +++ b/README.md @@ -3,37 +3,36 @@ A simple URL shortener built to be fast and easy. >Supports up to 262144 unique three-character links, guarantees absolutely zero collisions! -### Building +### Configuring -To deploy please first ensure you either have these variables in your enviroment or in your .env file. +To deploy please first create a `.env` file in the sho.rest root folder with your configuration. +You can use the `.env.example` file as a baseline. ``` -DATABASE_URL= -PORT= +POSTGRES_PASSWORD= +PORT= ``` -After you made sure these variables exist, run this to build the frontend. +To update create and manage Diesel migrations your .env also has to have a `DATABASE_URL` variable. +This is included in `.env.example` for simplicity -> sho.rest does not support npm at this point of time, but I doubt it's too hard to set up anyway. - -```sh -$ yarn postinstall +``` +DATABASE_URL=postgres://postgres:@localhost:5432/shorest ``` -After building the frontend, build the underlying server using: +Please note that the password you pick has to be the same in both variables. -```sh -$ cargo build --release -``` +### Deploying -### Running +sho.rest is fully built and deployed using `docker-compose`. +The URL database is created and stored inside a Docker volume. -Run the binary executable created by cargo in target using: +To start the necessary containers, simply run: ```sh -$ ./target/release/shorest +$ docker-compose up -d ``` -View the results at `http://localhost:` in your browser of choice! +You can view the results at `http://localhost:` in the browser of your choice! ---- -- cgit 1.4.1