-
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.
Besides untracking the .env files the docker-compose.yml got modified to rely on .env file only. This way a developer is not required to have two .env files. This is meant to limit the mental overhead required to start with the project but it has a downside of causing confilcts/errors while alternating between deployment types (local vs docker). Additionally the CONTRIBUTING.md got updated. Finally no more notes left from the old definition of the project.
- Loading branch information
1 parent
0357884
commit 107227c
Showing
6 changed files
with
51 additions
and
121 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 +1,5 @@ | ||
/trackers-api-server/target | ||
/trackers-models/target | ||
/target | ||
/db_data | ||
/db_data | ||
.env |
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,68 +1,43 @@ | ||
# Developement Guide | ||
|
||
___TODO: warn about some caveats of provided compose file___ | ||
|
||
Each part, back-end and front-end, may use different tools but the following instructions | ||
apply to both. | ||
|
||
## Required Tools | ||
|
||
### Docker | ||
|
||
The project uses docker to make it simpler to work on it while using different | ||
OSes as a developer. To install docker one should follow the guide applicable | ||
to a given operating system and distribution. | ||
- [Windows installation guide](https://docs.docker.com/desktop/install/windows-install/) | ||
- [RPM or Debian based Linux distributions](https://docs.docker.com/desktop/install/linux-install/) | ||
- [ArchLinux based distributions](https://docs.docker.com/desktop/install/archlinux/) | ||
|
||
Besides docker we will be using an extension to it called _docker compose_. | ||
It's a tool which can parse a special configuration file usually called | ||
`docker-compose.yml` and run multiple containers using the file as a recipe for | ||
their parameters. [To use _docker compose_ on Windows or | ||
Mac a desktop application is required](https://docs.docker.com/compose/install/) | ||
or the WSL. | ||
|
||
## Using the Tools | ||
|
||
### Launching the database | ||
|
||
To turn the database up execute: | ||
```sh | ||
sudo docker compose up database | ||
``` | ||
The database has it's ports exposed so it can be reached from the host using: | ||
```sh | ||
psql -d trackers -h 0.0.0.0 -p 5432 -U trackers | ||
``` | ||
The database may be empty when launched which can cause errors in the back-end | ||
application. In such a case it is recommended to run the migrator docker: | ||
```sh | ||
sudo docker compose up migrator | ||
``` | ||
If the migrator docker turns out to be too slow (it should take a while to | ||
build only at the first run) the original cli application for managing | ||
migrations can be installed. Check the [back-end's README](./back-end/README.md) | ||
for more details. | ||
|
||
### Launching back-end server | ||
|
||
To run back-end server execute: | ||
```sh | ||
sudo docker compose up back-end | ||
``` | ||
If you have the Rust toolchain available locally and want to iterate quickly | ||
using just `cargo` to compile the project is recommended. | ||
```sh | ||
cd back-end | ||
cargo dev | ||
``` | ||
More information can be found in [the back-end's README](./back-end/README.md). | ||
|
||
### Launching all the components | ||
It is a good idea to check occasionally if all the dockers can communicate with | ||
each other as expected. The website they are hosting should be available from | ||
the host. To turn on all the services execute: | ||
```sh | ||
sudo docker compose up | ||
``` | ||
# Contributing Guide | ||
|
||
<!--toc:start--> | ||
- [Contributing Guide](#contributing-guide) | ||
- [Running the Dockers](#running-the-dockers) | ||
- [Services](#services) | ||
- [`.env` file](#env-file) | ||
- [Project structure](#project-structure) | ||
<!--toc:end--> | ||
|
||
## Running the Dockers | ||
|
||
The project can be set up and used with docker compose. The compose file is | ||
constructed in such a way that no other than the | ||
`docker compose build; docker compose` actions are needed to run the API. What | ||
is however required is to fill a `.env` file which should be placed at the root | ||
of the repository. | ||
|
||
### Services | ||
|
||
The compose file runs multiple services. Two of them are provided only to build | ||
correctly other images, those are the `trackers-chef` and `trackers-planner` | ||
services. Along with the `migrator` service they are expected to successfully | ||
exit with __0__ code. The migrator prepares the database if neccessary. Left | ||
running should be the __database__ and the __api__ server. | ||
|
||
### `.env` file | ||
|
||
The provided compose configuration expects a _.env_ file to be located at the | ||
root of the repository. To fill in that file correctly check the environments | ||
defined for the GitHub repository of the project. Access to those may require | ||
the collaborator role within the GitHub repository. | ||
|
||
|
||
## Project structure | ||
|
||
The code is split into two crates: | ||
- `trackers-models` - defines the schema used by the Diesel ORM as well as any | ||
other models used by the API. The goal is to make it useful for anyone who | ||
would want to provide a client for the API server written in Rust or any other | ||
language that can use Rust source code. | ||
- `trackers-api-server` - the actuall API server and the place defining the | ||
business logic. |
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 was deleted.
Oops, something went wrong.