Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 2.6 KB

README.md

File metadata and controls

51 lines (38 loc) · 2.6 KB

Ossn Backend

Intro

This project is build using the following:

Setting up a machine

  1. Install go
  2. Install PostrgeSQL
  3. Install redis
  4. Install Dep
  5. Clone project into $GOPATH/src/github.com/ossn/ossn-backend and go into that directory
  6. Install dependencies by running dep ensure
  7. Set the environment variables defined in the .env.example file to your machine
  8. Build and run the application go run .

You can also use the docker file in this project to build the app but you still need to pass the environment variables to the container and connect the container to a PostgreSQL and to a Redis.

Deployment

The master branch of this project is automatically deployed to heroku and is used as the production server.

The instructions on "Setting up a machine" can be used to deploy this app to an alternative environment.

Development notes

  • Whenever a model is update this server is responsible for rebuilding the frontend website, in order for the server to achieve this the environment variable REBUILD_URL should be set to the rebuild hook of the frontend
  • Heroku has an issue with qor's static assets (the static assets of the admin panel), so whenever qor is update the static assets from inside the vendor folder should be placed inside the folder "app"
  • Once you've updated the schema.graphql file don't forget to run go generate ./... in order for your changes to be reflected in the go code

Project structure

  • app -> Static assets of the admin panel (see development notes for more info)
  • controllers -> The controller for the OpenID connect endpoints
  • helpers -> Small functions that are used across the project
  • main -> Main server configuration including routes and middleware declaration
  • middlewares -> Middleware definition
  • models -> Database models and database connection
  • resolvers -> Graphql models, Graphql mutation and query resolvers
  • scripts -> Allows to run generate command
  • Procfile -> Heroku's run command
  • gqlgen.yml -> Gqlgen configuration
  • schema.graphql -> Graphql definition