Skip to content
forked from fieldkit/cloud

cloud implementation for the fk platform. server and web architecture, etc...

Notifications You must be signed in to change notification settings

mikeedwards/cloud

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README for cloud

Overview

This repository contains:

  1. All backend server side code, mostly written in Golang.
  2. All public facing web sites, specifically the administrative site and the non-authenticated frontend.
  3. PostgreSQL schema and sample/seed data.

Developers

Machine Setup

Linux

  1. Install docker, nodejs, and yarn.
sudo apt-get install docker.io docker-compose nodejs
npm install -g yarn
  1. Configure docker
sudo gpasswd -a $USER docker
newgrp docker 
docker ps -a # testing
  1. Ensure you have the latest golang (>1.12)

OSX

  1. Install nodejs/npm (https://nodejs.org/en/download/)
  2. Install docker (https://docs.docker.com/docker-for-mac/install/)
  3. Ensure you have the latest golang (>1.12)

Running Locally

  1. Establish a default developer setup.
make

This will create a default fieldkit.env for you as well as materialize the various secrets.js files.

  1. Run the database.
make restart-postgres
➜  cloud git:(master) make restart-postgres
docker-compose stop postgres
docker-compose rm -f postgres
No stopped containers
docker-compose up -d postgres
Creating cloud_postgres_1 ... done
  1. Run the server.
./run-server.sh

This builds and runs the server outside of a docker container. This means that PostgreSQL is usually the only docker container running.

➜  cloud git:(master) ./run-server-containerless.sh
+ export FIELDKIT_ADDR=:8080
+ FIELDKIT_ADDR=:8080
+ export 'FIELDKIT_POSTGRES_URL=postgres://fieldkit:[email protected]/fieldkit?sslmode=disable'
+ FIELDKIT_POSTGRES_URL='postgres://fieldkit:[email protected]/fieldkit?sslmode=disable'
+ export FIELDKIT_DISABLE_MEMORY_LOGGING=true
+ FIELDKIT_DISABLE_MEMORY_LOGGING=true
+ export FIELDKIT_DISABLE_STARTUP_REFRESH=true
+ FIELDKIT_DISABLE_STARTUP_REFRESH=true
+ export FIELDKIT_API_DOMAIN=127.0.0.1:8080
+ FIELDKIT_API_DOMAIN=127.0.0.1:8080
+ export FIELDKIT_API_HOST=http://127.0.0.1:8080
+ FIELDKIT_API_HOST=http://127.0.0.1:8080
+ '[' -f aws.env ']'
+ make server
cp server/inaturalist/secrets.go.template server/inaturalist/secrets.go
cd server && env GOOS=linux GOARCH=amd64 go build -o /Users/jlewallen/fieldkit/cloud/build/server server.go
go: finding github.com/pkg/errors v0.0.0-20190227000051-27936f6d90f9
go: finding github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa
go: finding github.com/dghubble/sling v0.0.0-20170219194632-91b015f8c5e2
go: finding github.com/aws/aws-sdk-go v0.0.0-20170317202926-5b99715ae294
go: finding github.com/dghubble/oauth1 v0.0.0-20170219195226-3c7784d12fed
go: finding github.com/armon/go-metrics v0.0.0-20180713145231-3c58d8115a78
go: finding github.com/PyYoshi/goa-logging-zap v0.2.3
# Lots and lots more Golang packages.
+ build/server
2019-08-06T10:57:31.864-0700    INFO    fieldkit        server/server.go:135    Starting
2019-08-06T10:57:31.864-0700    INFO    fieldkit        server/server.go:343    Selected        {"archiver": "aws"}
2019-08-06T10:57:31.864-0700    INFO    fieldkit.backend        backend/concatenation.go:320    Worker starting
2019-08-06T10:57:31.891-0700    INFO    fieldkit.jobs   jobs/postgres.go:101    Listening       {"queue": "messages"}
# More startup log messages...
  1. Run one of the web sites in development mode.
cd portal
npm run serve
DONE  Compiled successfully

App running at:
- Local:   http://localhost:8081/
- Network: http://192.168.0.3:8081/

Note that the development build is not optimized.
To create a production build, use yarn build.

Migrations

We use this tool for database migrations:

https://github.com/golang-migrate/migrate/tree/master/cmd/migrate

Setup

  1. The link above has instructions on how to download the install the tool. Put the tool somewhere in your path.

New Migrations

  1. There’s a tool mkm.sh in this directory that will create a new migration with the name you’ve given. The file will create new up and down SQL files in the migrations directory.

Migrating

  1. Just run make `migrate-up` to migrate your local database.
  2. To rerun a migration, run migrate-down and then you can re-run migrate-up.

EOF

About

cloud implementation for the fk platform. server and web architecture, etc...

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PLpgSQL 40.7%
  • Go 20.9%
  • JavaScript 17.3%
  • Vue 11.8%
  • CSS 7.9%
  • TSQL 0.5%
  • Other 0.9%