diff options
| -rw-r--r-- | .env.example | 3 | ||||
| -rw-r--r-- | README.md | 33 |
2 files changed, 19 insertions, 17 deletions
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:<YOUR_POSTGRES_PASSWORD>@localhost:5432/shorest +POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD> +PORT=<YOUR_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=<yourdatabase> -PORT=<yourport> +POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD> +PORT=<YOUR_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:<YOUR_POSTGRES_PASSWORD>@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:<yourport>` in your browser of choice! +You can view the results at `http://localhost:<YOUR_PORT>` in the browser of your choice! ---- |
