Pre-Requirements | Running | Testing | Postman | Running outside docker | Tech Stack | Formatting | Deploy | Jobs
Contributions are always welcome, no matter how large or small.
You need to have installed:
It will take a while, about 20 minutes to download an compile all rust dependencies.
But that's it! Now go to
http://localhost:8000/admin and it should be running.
The default credentials for logging in the admin area are email:
To run the tests, with
docker-compose up running, fire up another terminal and execute:
docker-compose exec web cargo test
If you want to run it in watch mode, use:
docker-compose exec web cargo watch -x test
Postman is an app that helps you make requests when developing APIs.
We have a postman collection ready for you to use for debugging the API, just download postman and import the
Running Outside Docker
Also, you will need to have a postgres database running, if you don't, you can run it with docker-compose:
docker-compose up database
Install the rust and js dependencies:
cargo build cd src/scrapper/ npm install cd -
Create and migrate the database:
export DATABASE_URL="postgres://postgres:password@localhost:5432/fakenews" diesel database setup
Then start the app:
cargo watch -w src -x run
For compiling the admin area:
cargo watch -w admin -s "elm-make --yes admin/Main.elm --output target/admin.js"
To run the tests:
cargo watch -x test
This project is done in Rust, if you don't know Rust yet, the official guide is a good place to start. It shouldn't take very long before you can start contributing, just a few first chapters and you should be good to go, the compiler helps a lot.
For the web framework we use rocket, for starting a web server, routing, json-responses, etc.
Finally, we use docker-compose to launch the database and build an image with everything we need to run the project. By using docker we ensure that what's running locally is as close as possible from production.
We use rustfmt to automatically format the source code, please use it as well when developing new features, it integrates with most text editors and IDEs and keep a standard across the codebase.
Also, we add no configuration to it, just use the standard behaviours, this way we eliminate the discussions about formatting on PRs.
Configuring your IDE
To develop with Rust, having a well configured IDE helps A LOT, once you have a well configured one, you won't be able to code Rust without it anymore, so we recomment to spend a few minutes doing it.
- Autocomplete is working
- Code autoformats on save (rustfmt)
- Compilation errors and warnings show up on the IDE
- Code compiles on save
The deploy is automatically done by the CircleCI pipeline after merging to master.
If you want to learn more how it works, read about deploying to heroku with docker on the oficial docs.
There are some jobs for helping administrating the app, for creating and running migrations, check out diesel's docummentation. If you are running any diesel's job outside docker, you have to
Custom jobs are added on the
src/jobs.rs file, and ran like this:
cargo run -- --scrape-missing-data
or, if the app is installed: