All Projects → Staffjoy → V2

Staffjoy / V2

Licence: mit
Staffjoy V2 - all microservices in a monorepo

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
go
31211 projects - #10 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects
TSQL
950 projects

Projects that are alternatives of or similar to V2

Flow Mono Cli
A command line interface that aims to solve a few issues while working with flow typed codebases in a mono-repo.
Stars: ✭ 84 (-94.7%)
Mutual labels:  monorepo
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (-93.69%)
Mutual labels:  scheduling
Monorepo Diff Buildkite Plugin
Run separate pipelines for each folder in your monorepo
Stars: ✭ 110 (-93.06%)
Mutual labels:  monorepo
Scale
The Scale library offers a set of customizable web components written with Stencil.js & TypeScript. The default theme of the library can be easily replaced so that a corresponding corporate identity of a dedicated brand can be represented.
Stars: ✭ 87 (-94.51%)
Mutual labels:  monorepo
Angular Idle Preload
🔜 Angular Idle Preload for preloading async routes via @TipeIO
Stars: ✭ 98 (-93.82%)
Mutual labels:  scheduling
Nx Electron
Electron schematics for nrwl nx platform
Stars: ✭ 105 (-93.38%)
Mutual labels:  monorepo
Commudle Ng
World's first community management platform. And it's free!
Stars: ✭ 81 (-94.89%)
Mutual labels:  monorepo
Taskpacker
🎒 Simple schedule optimization library for Python
Stars: ✭ 115 (-92.75%)
Mutual labels:  scheduling
Semver
Nx plugin to automate semantic versioning and CHANGELOG generation.
Stars: ✭ 99 (-93.76%)
Mutual labels:  monorepo
Medical Appointment Scheduling
Concept showcase for "Appointment Scheduling System for Small and Medium-Sized Medical Facilities"
Stars: ✭ 109 (-93.13%)
Mutual labels:  scheduling
Time Table Scheduler
Time Table generation using Genetic Algorithms ( Java-Struts2)
Stars: ✭ 90 (-94.33%)
Mutual labels:  scheduling
Agenda Rest
Scheduling as a Service
Stars: ✭ 93 (-94.14%)
Mutual labels:  scheduling
Entangled
enTangle'd is an amalgamation of all things Tangle
Stars: ✭ 107 (-93.25%)
Mutual labels:  monorepo
Attemper
Distributed,multi-tenancy,job-flow scheduling application(分布式多租户的支持流程编排的任务调度平台) QQ群:1029617143
Stars: ✭ 86 (-94.58%)
Mutual labels:  scheduling
Liteflow
liteflow是一个基于任务版本来实现的分布式任务流调度系统
Stars: ✭ 112 (-92.94%)
Mutual labels:  scheduling
Nx Packaged
Angular libraries with ng-packagr embedded in Nx Workspace.
Stars: ✭ 82 (-94.83%)
Mutual labels:  monorepo
Has Changed Path
GitHub Action that saves time and money in monorepo environments
Stars: ✭ 102 (-93.57%)
Mutual labels:  monorepo
Optaweb Employee Rostering
Web application for solving Employee Rostering using OptaPlanner
Stars: ✭ 115 (-92.75%)
Mutual labels:  scheduling
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-92.81%)
Mutual labels:  monorepo
Colmena
Colmena is a starter kit for an API with an Admin interface that can be easily extended and built upon.
Stars: ✭ 1,420 (-10.47%)
Mutual labels:  monorepo

Staffjoy V2

Build Status Moonlight contractors Godoc Reference


Update - Sept 2019: This repo is deprecated. However, Oleg Glozman is maintaining an active fork of the repo:


Staffjoy is shutting down, so we are open-sourcing our code. This the second version of our product, a ground-up rewrite intended for small businesses, like restaurants. This product was very simple and did not provide features like allowing workers to log in, clock-in, etc. If you want those features, please use Staffjoy Suite You can learn about the design journey from V1 to V2 in this blog post.

Staffjoy V2

We started building V2 in August 2016, became feature complete in November 2016, and launched to the press in January 2017.

This is a monorepo, so all of the code for all of the services are in this repo. The core technologies are the Bazel build system, Kubernetes (including its DNS for internal service discovery), Redux, Go, Protocol Buffers, gRPC, and Yarn. In staging and production, we used Google Container Engine and their managed databases.

Credit

The authors of the original code were @philipithomas, @samdturner, @andhess, and some contractors. @kootommy designed the application and most of the marketing pages, and worked closely with engineering on implementation. This is a fork of the internal repository. For security purposes, the Git history has been squashed.

Services

Read about the V2 architecture on our blog

Staffjoy V2 Architecture

  • Faraday proxies all traffic from external services to internal ones. It also tells backend services whether a user is logged in. It's the only service that has a public IP address!
  • www (www.staffjoy.com) is the main marketing website. It also handles login and logout.
  • myaccount (myaccount.staffjoy.com) is a single-page javascript app that lets users modify their accounts
  • account-gateway (account.staffjoy.com) is the externally-available REST api for modifying accounts. It converts REST to gRPC for the accounts-datastore
  • accounts-server is the internal system that processes gRPC calls and stores/retrieves information using the account database.
  • company-gateway (company.staffjoy.com) is the externally-available REST api for modifying companies. It converts REST to gRPC for the companys-datastore
  • company-server is the internal system that processes gRPC calls and stores/retrieves information using the company database.
  • whoami (whoami.staffjoy.com) is a website that sends information about the current web session for easy access in the front-end.
  • superpowers (superpowers.staffjoy-v2.local) is a development-only website that lets you gain super user powers across Staffjoy (denoted as "support" flag on user accounts)
  • ical (ical.staffjoy-v2.local) is service serving up a worker's shift list through ical

External API Standards

  • Services should be RESTful JSON over HTTPS
  • Serve the spec at /swagger.json
  • Use the apidocs package to serve a swagger UI at /ui/

Dev

Getting started

Welcome to Staffjoy!

We use a monorepo that stores all of our code in this single repo. We use Vagrant to run a kubernetes cluster locally on your laptop. This makes it easy to run all of Staffjoy's services.

Setting up your Gopath

If you are running Go code, you should set up your $GOPATH, then clone this repository into the v2.staffjoy.com package:

mkdir -p $GOPATH/src/
git clone [email protected]:Staffjoy/v2.git $GOPATH/src/v2.staffjoy.com/

One-time dependencies on host machine (laptop)

  • Virtualbox
  • Vagrant, then run vagrant up to boot the dev server.
  • Vagrant host manager: vagrant plugin install vagrant-hostmanager
  • unison (see below)
  • modd (either from Go source or binary available [here])

Installing Unison

Unison syncs files between the host and the VM in a way that preserves simlinks.

Unfortunately, installing it on OSX is a bit of a pain because the version and the compiler must be the same as the one in Vagrant!

First, install OCaml version 3.12 - you may need to say "yes" to some command prompts:

wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin 3.12.1

Check that ocaml -version is 3.12.1. If it is not, try removing /usr/local/bin/ocaml and running opam switch 3.12.1.

Then, compile unison with this version of ocaml. You may be prompted for your password.

cd /tmp
curl -O https://www.seas.upenn.edu/~bcpierce/unison/download/releases/unison-2.40.102/unison-2.40.102.tar.gz
tar -xvzf unison-2.40.102.tar.gz
cd unison-2.40.102
make UISTYLE=text
sudo cp unison /usr/local/bin

Running the Environment

Run make dev. Code will boot and run at staffjoy-v2.local. Note that the first time you do this could take up to 45 minutes in order to provision the VM!

Changes will trigger an automatic rebuild and redeployment. (Check deployment progress at kubernetes.staffjoy-v2.local/ui/). End the dev server with control + c (and it will automatically shut off the VM).

Known Bug on OSX Sierra: If Vagrant cannot find download the box, run sudo rm /opt/vagrant/embedded/bin/curl. (Bug tracking link)

If you run into issues with stuck deployments in development - then run make dev-k8s-fix then re-run make dev.

Accessing the environment

Access the VM by running vagrant ssh. Code is located in /home/vagrant/golang/src/v2.staffjoy.com/ (aliased to $STAFFJOY, i.e. cd $STAFFJOY).

To build code and run it locally, in vagrant go to the code directory $STAFFJOY in vagrant, then run make dev-build for a one-time build.

If things are really goofing, run vagrant destroy -f then rebuild.

Debugging

  • There is a known bug where kubernetes does not come back after vagrant halts. To identify this, ssh into vagrant (vagrant ssh), then examine running docker containers (docker ps). If it's not running dozens of contianers, there's a problem. To fix this:, run make dev-k8s-fix. (Your local data may be wiped out).
  • If files are not syncing between your laptop and vagrant (to Vagrant's $STAFFJOY directory) - try running make dev again, or manually running unison (the syncer) on the host machine with ./vagrant/unison.sh.
  • If your machine can't keep up with autobuilding on changes, it may be preferred to stop using make dev and to instead call its two subcommands separately (manually): ./vagrant/unison.sh to sync files on your computer, then SSHing into Vagrant and manually triggering builds (cd $STAFFJOY && make dev-build)

Development resources

Go

Assets in Go

If you are loading assets like templates, CSS, JS, etc - you need to package the the data into the binary. Otherwise, the app will ship and it won't be able to find the assets!

To do this, use the go-bindata project. If you modify any of the asset files, you will need to rebuild them then commit the resulting bindata.go file and commit it. You have been warned!

Most services provide a build.sh file that compiles all the data that needs to be committed.

Development tools

The tool GoConvey is great for seeing tests.

Environment variables for configuration

  • ENV: Set to development,staging, or production. Null defaults to development
  • SENTRY_DSN: Set to the Sentry api key in every Go service for proper error tracking and reporting

Protocol Buffers

If you modify the files in protobuf/, run make protobuf to recompile all of the generated files.

⚠️ Please make sure that the version of protobuf matches the runtime version (see this issue):

go get github.com/golang/protobuf/...
cd $GOPATH/src/github.com/golang/protobuf/
# Switch to version that is packaged in app
git checkout df1d3ca07d2d07bba352d5b73c4313b4e2a6203e
# Re-install
go install github.com/golang/protobuf/proto
cd $GOPATH/src/v2.staffjoy.com/
make protobuf

If you're getting started with protocol buffers, here are some resources:

Working Offline

  • Email will break, but you can look at the system logs for the email service to see what would have been sent. (Useful for grabbing account activation links!)
  • See all Go documentation installed on the host machie with godoc -http=":8080". You'll be able to see all docs at localhost:8080
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].