hermes

command module
v0.0.0-...-4f40287 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

README

Hermes

A tool to manage a school and evaluate pupils skills acquisitions

Go Report Card Build Status Coverage Status

Requirements

You'll need to have a postgresql server up and running

Backend installation

You'll need to install go then you'll need to install govendor

Once this is done you'll be able to fetch all our dependencies: govendor sync

After this you should be able to build the backend server: go build

Backend configuration

You should create a yaml file $HOME/.config/hermes/hermes.yaml which looks like this:

# global section
database: "sslmode=disable dbname=hermes port=5432 user=hermes password=hermes"

# logger options
trace: true
debug: true

# auth section
auth_jwtsecret: "some super secret you need to change... this can be random!!!"

# fulltext search
fts.enabled: false
fts.url: http://localhost:9200

This is for convenience, in production we use env variables like such:

HERMES_DATABASE="dbname=hermes" HERMES_TRACE="false" HERMES_DEBUG="false" ...

as you can see each config entry you can find in the yaml file is upper cased and prefixed by HERMES_

Create the tables with: ./hermes init

Create a new user with: ./hermes createadmin

It should prompt you with a username and a password. This will be the first user you'll be able to use to connect to your web application.

Run the backend server with: ./hermes serve --debug

the --debug flag will help you see which configuration file is picked-up and used. If you prefer environment variables you can use: HERMES_DEBUG=true ./hermes serve

If you want to be able to search (you want to...) you should start an ElasticSearch server somewhere and point Hermes to it.

The easiest way to do this is to use docker:

docker run -p 9200:9200 -p 9300:9300 --rm --name elastic elasticsearch:5-alpine

Don't forget to set fts.enabled: true in the config file (default is false)

Once you have configured search you need to create the indices. You may also need to reindex your current database, ie: if you configure text-search after using hermes for a while.

This can be achieved by running this command:

hermes initsearch

If this gives no error (or only delete errors about missing indices), you are good to go and can run hermes serve as usual.

FrontEnd installation

The frontend can be found in the webclient directory.

You'll need to have nodejs installed for the development process (we use webpack)

Once nodejs is installed on your machine you'll need to install Elm 0.18: npm install elm@0.18

In the webclient directory you'll need to run: npm install

followed by: elm-package install

It should prompt you if it can download a few Elm packages, just answer yes.

At this point you're pretty done :), you can start the dev server: npm run dev

and open a brower on your webapp

In case of compilation error

From time to time after a pull from the repository you may encounter a elm compiler error

elm-make: Map.!: given key is not an element in the map

This means you'll need to remove the elm-stuff/build-artifacts directory and try again

Note to the developers

Don't forget to govendor sync regularly to make sure you have the correct dependencies, we use things like yago that we are contributing PRs on a regular basis.

How to completely refresh you local

1. Renew the database

Open pgadmin and remove the hermes database Create a new database ‘hermes’ with the owner ‘hermes’

2. Updating the project (backend)

Open terminal, go into the hermes folder and run the following commands :

git pull

govendor sync

go build

3. Updating the project (front)

Open terminal, go into the hermes/webclient folder and run the following commands :

npm install

elm-package install

4. Updating the database

Open terminal, go into the hermes folder and run the following commands :

./hermes init --debug

./hermes createadmin (For login (admin) and password (twice), enter the value ‘hermes’)

5. ElasticSearch

Launch Docker (app or service)

Open terminal, go into the hermes/webclient folder and run the following command :

npm run elastic (or docker run -p 9200:9200 -p 9300:9300 --rm --name elastic elasticsearch:5-alpine)

...and keep this process running

Open terminal, go into the hermes/webclient folder and run the following commands :

./hermes initsearch --fts.sniff=false

./hermes serve --debug --fts.sniff=false

...and keep this process running

6. Run webpack

Open terminal, go into the hermes/webclient folder and run the following command :

npm run dev

...and keep this process running

7. Go to http://localhost:3000

Testing

We use standard go tests, the easiest way to run those is to use GoConvey

It will help you run tests automatically, see coverage reports and if you enable desktop notifications you'll be able to see the coverage delta since last time :)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
header
Package header provides functions for parsing HTTP headers.
Package header provides functions for parsing HTTP headers.
lib
Package hermes provides a few things that we may need
Package hermes provides a few things that we may need
logger
Package logger provides logging facilities for the NATS server
Package logger provides logging facilities for the NATS server
tools
Package tools provides utilities like the logger to all parts of the project
Package tools provides utilities like the logger to all parts of the project
Recovery middleware for Negroni, heavily inspired by github.com/urfave/negroni/recovery.go
Recovery middleware for Negroni, heavily inspired by github.com/urfave/negroni/recovery.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL