Boxmeup is a web and mobile application to help users keep track of what they have in their containers and how to find items in specific containers.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
bin
config
database
hooks
middleware
models
modules
routing
vendor
.drone.yml
.env.sample
.gitignore
Dockerfile
Gopkg.lock
Gopkg.toml
LICENSE.md
README.md
docker-compose-beta.yml
docker-compose-dev.yml
migration.sql
schema.sql

README.md

Boxmeup Server

This is a WIP Go implementation of Boxmeup.

Boxmeup is a web and mobile application to help users keep track of what they have in their containers and how to find items in specific containers.

Requirements

Setup

cp .env.sample .env
cp docker-compose-dev.yml docker-compose.yml

Note: there is no production compose file yet.

Modify the docker compose file to suit needs.

docker-compose up -d

Bring your own mysql:

docker run -p 8080:8080 -e MYSQL_DSN=username:password@host:port/database cjsaylor/boxmeup-go

See .env.sample for available configurations.

Testing

A Drone CI instance is used to run tests. To run them locally, setup Drone CLI (instructions for MacOS):

Install Drone CLI

curl -L https://github.com/drone/drone-cli/releases/download/v0.8.0/drone_darwin_amd64.tar.gz | tar zx
sudo cp drone /usr/local/bin

or with Homebrew:

brew tap drone/drone
brew install drone

See Drone CLI documentation

Execute Tests

drone exec

Development

In order to run tests you will need to prepare your MySQL db by running the schema.sql on the MySQL db you plan to use. If you use the docker provided MySQL image specified in the docker-compose.yml file, you can run (on the running server):

# For local development
cat schema.sql | docker exec -i $(docker-compose ps -q mysql) mysql boxmeup -u boxmeup -pboxmeup

Create a user:

curl -X POST \
  http://localhost:8080/api/user/register \
  -H 'content-type: multipart/form-data' \
  -F email=test@test.com \
  -F password=test1234

Obtain a json-webtoken (for use in subsequent requests to the API):

curl -X POST \
  http://localhost:8080/api/user/login \
  -H 'content-type: multipart/form-data' \
  -F email=test@test.com \
  -F password=test1234

This will yield a token:

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDQ5NTY5NjYsImlkIjoxLCJuYmYiOjE1MDQ1MjQ5NjYsInV1aWQiOiI5Yzk1MWIyNi05MGU1LTExZTctOTY0Ny0wMjQyYWMxMjAwMDIifQ.mgumlN4hQ5Wq3lmK1uiO9tAX21UOv7kLx5MYFI9KcdA"
}

Use the token in the header of further API requests (cURL example):

-H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTU1NTI1MzgsImlkIjoyLCJuYmYiOjE0OTUxMjA1MzgsInV1aWQiOiJkMjU1MzY5OC0zYmRjLTExZTctYTU0NC0wODAwMjdkNGZkMjgifQ.ccSUP9AOrBplbwBs6e8dpTpePXHLipBSHvnYL1gFalw'

Dependencies are committed into the vendor/ directory via dep, so no go install required.

To build: go build -o server ./bin

Proprietary Code

Proprietary code is included via go packages built with the -buildmode=plugin flag for the appropriate OS. The plugin must expose a symbol of a "instantiated" struct that implements hooks.RouteHook.

To build the proprietary source, it must be included in the vendor/ directory. Then copy the .so file to the hooks/ directory and update modules/routing/router.go to pull it in at starup.