Make learning & school open source
This assumes running on Ubuntu
- Install postgres
sudo apt install postgres - Install rust/rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - Install diesel_cli
cargo install diesel_cli(depending on your environment, there may be errors; refer to diesel.rs & google to help you) - Install git
sudo apt install git - Navigate to desired parent folder
- I like to structure my git repositories like
~/git/github/<org or user>/<repo>
- I like to structure my git repositories like
- Clone repository
git clone https://github.com/ClaytonDoesThings/school_things.git - Enter repository folder
cd school_things - Setup database
- Enter postgres user
sudo su - postgres - Enter postgres CLI
psql - Set postgres database password
ALTER USER postgres PASSWORD 'desiredPassword'; - Exit CLI
exit - Create database
createdb school_things; - Exit postgres user
exit
- Enter postgres user
- Setup diesel environment
- Create
.envfile in repository root (Make sure )
DATABASE_URL=postgres://postgres:<postgres password>@localhost/school_things - Run diesel setup
diesel setup - Run migrations
diesel migration run
- Create
- Setup rocket.rs
- Set folder to use the nightly version of rust
rustup override set nightly - Create
Rocket.tomlfile in repository root (remember to replace<>)[development] address = "0.0.0.0" secret_key = "<output of running `openssl rand -base64 32`>" [global.databases] postgres = { url = "postgres://postgres:<postgres password>@localhost/school_things" }
- Set folder to use the nightly version of rust
- Run
cargo run