motki_server

package module
v0.0.0-...-5c8b849 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: MIT Imports: 0 Imported by: 0

README

motki-server

The MOTKI application server.

GoDoc

Getting started

This repository contains the motkid source code, including dependency source code (stored in vendor/).

Pre-requisites for building
  • A recent Go compiler
  • go-bindata
    go get -u github.com/jteeuwen/go-bindata/...
    
  • postgres9 client (psql and pg_restore)
  • protoc and proto-gen-go
  • cat, awk, sed, grep, curl, bunzip2, unzip, git
Requirements for running
  • An available PostgreSQL database.
  • A SMTP provider.
  • A machine to run motkid on.

Install using make

Download a copy of this repository and verify that the Makefile works.

curl -L -o motkid-master.tar.gz https://github.com/motki/motki-server/archive/master.tar.gz
tar xzf motkid-master.tar.gz
cd motkid-master
make debug

Assuming you haven't copied config.toml.dist to config.toml, you will be greeted with an error.

Makefile:61: *** config.toml does not exist. Copy config.toml.dist and edit appropriately, then try again..  Stop.

Once you've copied config.toml, you can actually build the program. The simplest way is make.

Makefile reference
Target Description
build Build the motkid binary.
install Installs database schemas and EVE static dump data.
uninstall Drop created database schemas and EVE static dump data.
clean Delete all build files.
generate Runs go generate.
matrix Build a matrix of arches and OSes, see below.
download Download EVE static dump data.
assets Installs EVE static dump data.
db Install the required schema definitions into the database.
schema_evesde Installs the EVE static dump schema definitions.
schema_app Installs the app schema definitions.

Note that Makefile targets that deal with the database connect to the server defined in config.toml

Notes

Build for a specific OS and arch

make build GOOS=linux GOARCH=arm7

Cross-compile the binaries for many platforms at once

make matrix ARCHES="amd64 arm6 arm7 386" OSES="windows linux darwin"

Manual Installation

Clone or download the repository.

This application does not rely on $GOPATH, but if you are planning on making changes, it may help to put it there.

Below is an example of one way to get the code.

This assumes you have a simple $GOPATH with only one value (and no colons in it)

mkdir -p $GOPATH/src/github.com/motki
git clone git@github.com:motki/motki-server $GOPATH/src/github.com/motki/motki-server
cd $GOPATH/src/github.com/motki/motki-server
Install resources

Load the data in the resources folder.

  1. Un-bzip the evesde-*-postgres.dmp.bz2.
  2. Use pg_restore to load the EVE static dump.

    Warnings abouts a missing "yaml" role can be ignored.

  3. Extract the Icons and Types zips to public/images (creating public/images/Icons and public/images/Types)

Configuration

Copy config.toml.dist to config.toml and edit appropriately.

Configuring the EVE API

To use the EVE API you need to set up an Application at the EVE Developer Portal. You'll need to select appropriate roles (all of them is fine) and then set a correct Return URL for your setup.

Note: the Return URL can include a port specification.

Once you have created your application on the developer portal, put the Client ID, Secret, and Return URL in the corresponding section in config.toml.

Configuring SSL

You need to generate a certificate and private key to properly set up SSL. During development, a self-signed certificate is recommended. For production deployments, the process is made simpler by using Let's Encrypt to automatically generate a valid certificate.

Using Let's Encrypt is highly recommended. See this section for more information on setting up Let's Encrypt.

Generating a cert with Let's Encrypt
  1. Configure the SSL section in config.toml
    1. Set autocert=true in config.toml.
    2. Set certfile="" and keyfile="" in config.toml
    3. Set the SSL listen parameter to a valid public hostname.
  2. ...
  3. Profit
Generating a self-signed cert
  1. Copy the source code from this stdlib utility: generate_cert.go.
  2. Put it inside its own package (something like ./cmd/gencert/ in the project directory).
  3. Compile and run it: go run ./cmd/gencert/generate_cert.go --host localhost
  4. There should now be a key.pem and cert.pem file in the current working directory. Update config.toml with the path to these.
  5. Start motkid

Don't commit the gencert utility or the generated keys to the source code repository.

Running motkid

Build the motkid command using make, then run the resulting executable.

$ make clean build
$ build/motkid -h
Usage of build/motkid:
  -conf string
    	Path to configuration file. (default "config.toml")
  -version
    	Display the application version.

Documentation

Overview

Package motki_server is an EVE Online corporation management tool.

Notably, this project contains the motkid source code, which is the main motki application server. motkid functions as a remote grpc server for clients, as well as a web application.

Directories

Path Synopsis
Package app contains functionality related to creating an integrated motki-server environment with all the necessary dependencies.
Package app contains functionality related to creating an integrated motki-server environment with all the necessary dependencies.
cmd
motkid
Command motkid starts a motki application server.
Command motkid starts a motki application server.
Package http manages the motki application web server.
Package http manages the motki application web server.
auth
Package auth manages authentication for the motki application.
Package auth manages authentication for the motki application.
middleware
Package middleware contains HTTP middlewares for Session and Auth.
Package middleware contains HTTP middlewares for Session and Auth.
module/assets
Package assets is the web module responsible for serving static assets.
Package assets is the web module responsible for serving static assets.
module/home
Package home contains the basic public functionality of the MOTKI app.
Package home contains the basic public functionality of the MOTKI app.
module/industry
Package industry contains functionality related to market and industry.
Package industry contains functionality related to market and industry.
module/market
Package market contains functionality related to market and industry.
Package market contains functionality related to market and industry.
route
Package route encapsulates HTTP routing and handlers.
Package route encapsulates HTTP routing and handlers.
session
Package session provides session management capabilities.
Package session provides session management capabilities.
template
Package template provides template rendering capabilities.
Package template provides template rendering capabilities.
Package mail provides a light wrapper around SMTP functionality.
Package mail provides a light wrapper around SMTP functionality.

Jump to

Keyboard shortcuts

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