From 757770635c4c2537b03f9b1fb1576a8bf4609a72 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 11 Jan 2018 19:38:28 +0100 Subject: Update readme with Vagrant setup --- README.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 27a4714..a9d1bb0 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,33 @@ This is essentially a toy project to learn [Rocket](https://rocket.rs) and [Dies ## Getting started +### Using Vagrant + +You need to inatsll both [Vagrant] and [VirtualBox] unless you already have them installed. Then from the directory where you have cloned the rocket-blog type: + + % vagrant up + +This will install, prepare and start the virtual machine where you will run the program. This will take some time the first time you do it. Once it is done, you can log in to the virtual machine by typing: + + % vagrant ssh + +In the virtual machine, do the following: + + % cd /vagrant + % echo "DATABASE_URL=postgres://vagrant@localhost/rocket_blog" > .env + % diesel setup + +The application is now ready, and can be started like this: + + % cargo run + +Now you can open http://localhost:8000 in your web browser. + +### Using a local developer setup + First make sure you have PostgreSQL installed. We don't support any other database engine for now. You also need the nightly Rust compiler for now. To set the current project to use the nightly compiler, run: - % rustup override nightly + % rustup override nightly-2017-12-21 Then add a database url into a `.env`-file that is to be located in the root of the source directory: @@ -15,7 +39,6 @@ Then add a database url into a `.env`-file that is to be located in the root of Then create the user and database specified above: % createuser -U postgres --createdb --login -P dbuser - % createdb -U dbuser dbname -T template0 Replace `dbuser`, `dbname` and `password` with values that makes sense to you. You will be prompted for the password when creating the user. @@ -38,3 +61,6 @@ Run the engine: ## License This project is provided as free software under the GNU AGPL v3, see LICENSE for details. + +[Vagrant]: https://www.vagrantup.com +[VirtualBox]: https://www.virtualbox.org/ -- cgit v1.2.3