server

command module
v0.0.0-...-70fadbe Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

README

Wrabit Server

Getting Started

Requirements

For now the following are required:

  • Stripe (for payments)
  • Firebase (for auth)
  • Mailgun (for sending emails)

I will do my best to work on removing these requirements in dev but I don't know if/how/when that will happen.

Environment
// Sets your environment to dev which turns off some handy things
// like the Sqreen agent. It also turns on the GraphQL playground
NODE_ENV=dev

// The username to login to postgres wth
CLOUDSQL_USER=postgres

// The password for the postgres user
CLOUDSQL_PASSWORD=allthesecurity

// For local dev this is the name of the Docker DB container (the host)
CLOUDSQL_CONNECTION_NAME=database

// Database to connect to
CLOUDSQL_DATABASE_NAME=wrabit

// Client secret used to connect with Firebase
GOOGLE_APPLICATION_CREDENTIALS=client-secret.json

// Used to interact with the Stripe platform
STRIPE_KEY=XXXXXXXXXXXXXXXXXXXX

// Used to send email through mailgun
MAILGUN_KEY=XXXXXXXXXXXXXXXXXXXX

// Used to encrypt user data
ENCRYPTION_KEY=thisencryptsuserdatainthedatabase
Setup
  1. Create required accounts (see above)
  2. Copy .env.example to .dev.env and fill out the fields
  3. Modify last line of wrabit.sql to have a user for testing (or manually create an account)
  4. Run docker-compose up

Generate GraphQL Schema

  1. Make changes to schema.graphql
  2. Run go generate ./... from the root directory

Managing SQL Schema

The schema is currently managed by one SQL file (wrabit.sql). Once the database becomes larger, we will be forced to solve the schema management problem. Until then...

Connect to GCP SQL
  1. Run the gcloud SQL connect command (this will whitelist your IP for 5 minutes)

    gcloud sql connect wrabit-postgres
    
  2. Enter password for database (check .prod.env file)

  3. Switch to the wrabit database

    \c wrabit
    

Encrypting Secrets

Secrets are currently stored in a local .stage.env/.prod.env file. In order to get them onto the CI/CD pipeline, we need to use Travis' encrypt tool.

make update-secrets

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Provides symmetric authenticated encryption using 256-bit AES-GCM with a random nonce.
Provides symmetric authenticated encryption using 256-bit AES-GCM with a random nonce.
graph

Jump to

Keyboard shortcuts

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