pantahub-base

command module
v0.0.0-...-c9f6891 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Pantahub Base APIs reference implementation.

Prepare

  • get a reasonable fresh golang engine (1.9++) and install it
  • Install a mongodb database locally or get credentials for hosted instance
  • Install elasticsearch 6.x.x and start it using default settings
  • Install fluentd or td-agent (on windows) and start it using with the config include in pantahub-base source: fluentd.localhost.conf
  • Decide where you want to store the objects. By default we store objects in $CWD/../local-s3/ folder; you can use environment variables (see below) to adjust this

Build

$ go get -v u gitlab.com/pantacor/pantahub-base
...

$ go build -o ~/bin/pantahub-base gitlab.com/pantacor/pantahub-base
...

Test

  • Note:Make Sure testharness project is accessible
$ git clone -b develop https://gitlab.com/pantacor/pantahub-testharness
...

$ go test -v ./tests/... ...

Run

$ pantahub-base
mongodb connect: mongodb://localhost:27017/pantabase-serv
S3 Development Path: ../local-s3/
2017/06/19 21:56:04 Serving @ https://127.0.0.1:12366/
2017/06/19 21:56:04 Serving @ http://127.0.0.1:12365/
2017/06/19 21:56:04 Serving @ https://::1:12366/
2017/06/19 21:56:04 Serving @ http://::1:12365/
2017/06/19 21:56:04 Serving @ https://10.42.0.1:12366/
2017/06/19 21:56:04 Serving @ http://10.42.0.1:12365/
2017/06/19 21:56:04 Serving @ https://fe80::90a9:7a0:a5d5:f808:12366/
2017/06/19 21:56:04 Serving @ http://fe80::90a9:7a0:a5d5:f808:12365/
2017/06/19 21:56:04 Serving @ https://192.168.178.75:12366/
2017/06/19 21:56:04 Serving @ http://192.168.178.75:12365/
2017/06/19 21:56:04 Serving @ https://2a02:2028:66c:1201:3bae:315f:3ad8:c6ee:12366/
2017/06/19 21:56:04 Serving @ http://2a02:2028:66c:1201:3bae:315f:3ad8:c6ee:12365/
2017/06/19 21:56:04 Serving @ https://fe80::f64a:6b7d:ede:b208:12366/
2017/06/19 21:56:04 Serving @ http://fe80::f64a:6b7d:ede:b208:12365/
2017/06/19 21:56:04 Serving @ https://172.18.0.1:12366/
2017/06/19 21:56:04 Serving @ http://172.18.0.1:12365/
2017/06/19 21:56:04 Serving @ https://fe80::42:82ff:fea9:63a4:12366/
2017/06/19 21:56:04 Serving @ http://fe80::42:82ff:fea9:63a4:12365/
2017/06/19 21:56:04 Serving @ https://172.17.0.1:12366/
2017/06/19 21:56:04 Serving @ http://172.17.0.1:12365/
2017/06/19 21:56:04 Serving @ https://fe80::42:97ff:fef7:9daa:12366/
2017/06/19 21:56:04 Serving @ http://fe80::42:97ff:fef7:9daa:12365/
2017/06/19 21:56:04 Serving @ https://fe80::5491:a3ff:fed7:c798:12366/
2017/06/19 21:56:04 Serving @ http://fe80::5491:a3ff:fed7:c798:12365/
2017/06/19 21:56:04 Serving @ https://fe80::c0a3:b4ff:fe0d:e3b8:12366/
2017/06/19 21:56:04 Serving @ http://fe80::c0a3:b4ff:fe0d:e3b8:12365/

Configure

We currently support the environment variables you can find in utils/env.go:

const (
	// Pantahub JWT Secret. THIS MUST BE SET TO SOMETHING SECRET!!
	// default: "THIS MUST BE CHANGED"
	EnvPantahubJWTAuthSecret = "PANTAHUB_JWT_SECRET"

	// Host you want clients to reach this server under
	// default: localhost
	EnvPantahubHost       = "PANTAHUB_HOST"

	// Port you want to make this server available under
	// default: 12365 for http and 12366 for https
	EnvPantahubPort       = "PANTAHUB_PORT"

	// Default scheme to use for urls pointing at this server when we encode
	// them in json or redirect (e.g. for auth)
	// default: http
	EnvPantahubScheme     = "PANTAHUB_SCHEME"

	// XXX: not used
	EnvPantahubAPIVersion = "PANTAHUB_APIVERSION"

	// Authentication endpoint to point clients to that need access tokens
	// or need more privileged access tokens.
	// default: $PANTAHUB_SCHEME://$PANTAHUB_HOST:$PANTAHUB_PORT/auth
	EnvPantahubAuth       = "PH_AUTH"

	// port to listen to on for http on internal interfaces
	// default: 12365
	EnvPantahubPortInt     = "PANTAHUB_PORT_INT"

	// port to listen to on for https on internal interfaces
	// default: 12366
	EnvPantahubPortIntTLS = "PANTAHUB_PORT_INT_TLS"

	// Hostname for mongodb connection
	// default: localhost
	EnvMongoHost          = "MONGO_HOST"

	// Port for mongodb connection
	// default: 27017
	EnvMongoPort          = "MONGO_PORT"

	// Database name for mongodb connection
	// default: pantabase-serv
	EnvMongoDb            = "MONGO_DB"

	// Database user for mongodb connection
	// default: <none>
	EnvMongoUser          = "MONGO_USER"

	// Database password for mongodb connection
	// default: <none>
	EnvMongoPassword          = "MONGO_PASS"

	// SMTP host to use for sending mails
	// default: <none>
	EnvSMTPHost           = "SMTP_HOST"

	// SMTP port to use for sending mails
	// default: <none>
	EnvSMTPPort           = "SMTP_PORT"

	// SMTP user to use for sending mails
	// default: <none>
	EnvSMTPUser           = "SMTP_USER"

	// SMTP pass to use for sending mails
	// default: <none>
	EnvSMTPPass           = "SMTP_PASS"
)

APIs

The following APIs are currently included and documented:

PVR

The most convenient way to interface with pantahub for a subset of its features is through the pvr tool.

See https://gitlab.com/pantacor/pvr for more features.

Docker

Convenience docker builds are available in gcr.io/pantahub-registry/pantahub-base

To run the latest:

docker run -it --rm \
	-v/path/to/storage:/opt/ph/local-s3 \
	gcr.io/pantahub-registry/pantahub-base:latest

Build your own Docker

Want to build your own docker images? Check out https://gitlab.com/pantacor/pantahub-containers/ and the readmes there

Docker Compose

Get start with docker-compose:

$ docker-compose up -d

Create the test local s3 bucket

$ ./locals3.bash mb s3://testing/
make_bucket: testing

Run all tests

$ docker-compose exec base go test ./...

Kubernetes

Check our example deployment manifest in https://gitlab.com/pantacor/pantahub-containers/api/k8s directory.

Issues/Support:

Please use Issue trackers on gitlab.

Documentation

Overview

Copyright 2017 Pantacor Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Directories

Path Synopsis
Package apps package to manage extensions of the oauth protocol
Package apps package to manage extensions of the oauth protocol
Package auth package to manage extensions of the oauth protocol
Package auth package to manage extensions of the oauth protocol
oauth
Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders
Package oauth package to manage extensions of the oauth protocol for oauth oAuthProviders
Package devices all devices related logic
Package devices all devices related logic
Package logs provides the abstract logging infrastructure for pantahub logging endpoint as well as backends for elastic and mgo.
Package logs provides the abstract logging infrastructure for pantahub logging endpoint as well as backends for elastic and mgo.
Package plog offers a simple mean to share pvr repos with others.
Package plog offers a simple mean to share pvr repos with others.
Package trails offer a two party master/slave relationship enabling the master to asynchronously deploy configuration changes to its slave in a stepwise manner.
Package trails offer a two party master/slave relationship enabling the master to asynchronously deploy configuration changes to its slave in a stepwise manner.

Jump to

Keyboard shortcuts

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