charmstore

package module
v5.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: AGPL-3.0 Imports: 17 Imported by: 13

README

juju/charmstore

Store and publish Juju charms and bundles.

Installation

To start using the charm store, first ensure you have a valid Go environment, then run the following:

go get -d gopkg.in/juju/charmstore.v5-unstable
cd $GOPATH/gopkg.in/juju/charmstore.v5-unstable

Go dependencies

The project uses godeps (https://launchpad.net/godeps) to manage Go dependencies. To install this, run:

go get launchpad.net/godeps

After installing it, you can update the dependencies to the revision specified in the dependencies.tsv file with the following:

make deps

Use make create-deps to update the dependencies file.

Development environment

A couple of system packages are required in order to set up a charm store development environment. To install them, run the following:

make sysdeps

To run the elasticsearch tests you must run an elasticsearch server. If the elasticsearch server is running at an address other than localhost:9200 then set JUJU_TEST_ELASTICSEARCH=<host>:<port> where host and port provide the address of the elasticsearch server. If you do not wish to run the elasticsearh tests, set JUJU_TEST_ELASTICSEARCH=none.

At this point, from the root of this branch, run the command::

make install

The command above builds and installs the charm store binaries, and places them in $GOPATH/bin. This is the list of the installed commands:

  • charmd: start the charm store server;
  • essync: synchronize the contents of the Elastic Search database with the charm store.

A description of each command can be found below.

Testing

Run make check to test the application. Run make help to display help about all the available make targets.

Charmstore server

Once the charms database is fully populated, it is possible to interact with charm data using the charm store server. It can be started with the following command:

charmd -logging-config INFO cmd/charmd/config.yaml

The same result can be achieved more easily by running make server. Note that this configuration should not be used when running a production server, as it uses a known password for authentication.

At this point the server starts listening on port 8080 (as specified in the config YAML file).

Documentation

Index

Constants

View Source
const (
	DockerAuth = "docker-registry"
	Legacy     = ""
	V4         = "v4"
	V5         = "v5"
)

Versions of the API that can be served.

Variables

This section is empty.

Functions

func Versions

func Versions() []string

Versions returns all known API version strings in alphabetical order.

Types

type HTTPCloseHandler

type HTTPCloseHandler interface {
	Close()
	http.Handler
}

HTTPCloseHandler represents a HTTP handler that must be closed after use.

func NewServer

func NewServer(db *mgo.Database, es *elasticsearch.Database, idx string, config ServerParams, serveVersions ...string) (HTTPCloseHandler, error)

NewServer returns a new handler that handles charm store requests and stores its data in the given database. The handler will serve the specified versions of the API using the given configuration.

type ServerParams

type ServerParams struct {
	// AuthUsername and AuthPassword hold the credentials
	// used for HTTP basic authentication.
	AuthUsername string
	AuthPassword string

	// IdentityLocation holds the location of the third party authorization
	// service to use when creating third party caveats,
	// for example: http://api.jujucharms.com/identity
	IdentityLocation string

	// TermsLocations holds the location of the
	// terms service, which knows about user agreements to
	// Terms and Conditions required by the charm.
	TermsLocation string

	// PublicKeyLocator holds a public key store.
	// It may be nil.
	PublicKeyLocator bakery.PublicKeyLocator

	// AgentUsername and AgentKey hold the credentials used for agent
	// authentication.
	AgentUsername string
	AgentKey      *bakery.KeyPair

	// StatsCacheMaxAge is the maximum length of time between
	// refreshes of entities in the stats cache.
	StatsCacheMaxAge time.Duration

	// SearchCacheMaxAge is the maximum length of time between
	// refreshes of entities in the search cache.
	SearchCacheMaxAge time.Duration

	// MaxMgoSessions specifies a soft limit on the maximum
	// number of mongo sessions used. Each concurrent
	// HTTP request will use one session.
	MaxMgoSessions int

	// HTTPRequestWaitDuration holds the amount of time
	// that an HTTP request will wait for a free connection
	// when the MaxConcurrentHTTPRequests limit is reached.
	HTTPRequestWaitDuration time.Duration

	// AuditLogger optionally holds the logger which will be used to
	// write audit log entries.
	AuditLogger *lumberjack.Logger

	// RootKeyPolicy holds the default policy used when creating
	// macaroon root keys.
	RootKeyPolicy mgostorage.Policy

	// MinUploadPartSize holds the minimum size of
	// an upload part. If it's zero, a default value will be used.
	MinUploadPartSize int64

	// MaxUploadPartSize holds the maximum size of
	// an upload part. If it's zero, a default value will be used.
	MaxUploadPartSize int64

	// MaxUploadParts holds the maximum number of upload
	// parts that can be uploaded in a single upload.
	// If it's zero, a default value will be used.
	MaxUploadParts int

	// RunBlobStoreGC holds whether the server will run
	// the blobstore garbage collector worker.
	RunBlobStoreGC bool

	// NewBlobBackend returns a new blobstore backend
	// that may use the given MongoDB database.
	// If this is nil, a MongoDB backend will be used.
	NewBlobBackend func(db *mgo.Database) blobstore.Backend

	// DockerRegistryAddress contains the address of the docker
	// registry associated with the charmstore.
	DockerRegistryAddress string

	// DockerRegistryAuthCertificates contains the chain of
	// certificates used to validate the DockerRegistryAuthKey.
	DockerRegistryAuthCertificates []*x509.Certificate

	// DockerRegistryAuthKey contains the key to use to sign
	// docker registry authorization tokens.
	DockerRegistryAuthKey crypto.Signer

	// DockerRegistryTokenDuration is the time a docker registry
	// token will be valid for after it is created.
	DockerRegistryTokenDuration time.Duration
}

ServerParams holds configuration for a new internal API server.

Directories

Path Synopsis
cmd
migrateblobs
This command migrates blobstore blobs of charms and resources for all entities.
This command migrates blobstore blobs of charms and resources for all entities.
The config package defines configuration parameters for the charm store.
The config package defines configuration parameters for the charm store.
internal
charmstore
This is the internal version of the charmstore package.
This is the internal version of the charmstore package.
entitycache
Package entitycache provides a cache of charmstore entities and base-entities, designed to be used for individual charmstore API requests.
Package entitycache provides a cache of charmstore entities and base-entities, designed to be used for individual charmstore API requests.
legacy
The legacy package implements the legacy API, as follows: /charm-info A GET call to `/charm-info` returns info about one or more charms, including its canonical URL, revision, SHA256 checksum and VCS revision digest.
The legacy package implements the legacy API, as follows: /charm-info A GET call to `/charm-info` returns info about one or more charms, including its canonical URL, revision, SHA256 checksum and VCS revision digest.
router
The router package implements an HTTP request router for charm store HTTP requests.
The router package implements an HTTP request router for charm store HTTP requests.
series
Package series holds information about series supported in the charmstore.
Package series holds information about series supported in the charmstore.
v4
v5

Jump to

Keyboard shortcuts

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