submission service #0

Supports: xenial

Add to new model

Description

This web service accepts and validates Checkbox submissions
before passing them on to a C3 web service for further processing.


Overview

This charm provides the Submission
Service
.
This service accepts and validates Checkbox
submissions before passing them on to a C3 service for further processing.

Usage

The submission-service is available as a snap, and it can be passed to this charm
as a resource or the layer-snap will download it from the snap store for us::

Command to deploy the service from the snap store::

juju deploy /path/to/charms/xenial/submission-service

Command to deploy the service from a local resource::

juju deploy /path/to/charms/xenial/submission-service --resource submission-service=/path/to/submission-service.snap

Commands to configure and deploy a minimal stack for the service.

juju deploy postgresql
juju deploy apache2
juju expose apache2
juju add-relation submission-service:database postgresql:db-admin
juju add-relation submission-service:website apache2:reverseproxy
# set config values as appropriate. these are examples
juju config submission-service\
    swift_container=submissionservice_test\
    swift_tenant=codersquid_project\
    swift_region=myregion\
    swift_auth_url=https://keystonehost/v2.0/\
    swift_api_key=FAKE_API_KEY\
    swift_user=codersquid\
    c3_user=codersquid\
    c3_api_key=FAKE_C3_KEY

Note: the db-admin relation is needed for the PostgreSQL service currently to
avoid object ownership issues.

Once the hooks and reactions have run their course, you should be able to
request version information to see that the service is responding.::

juju expose submission-service # if you want to hit the service directly
curl http://<unit_address>:8080/1.0/version
{"result":true,"code":"","message":"ok","version":"1.0"}

Development

Event cycle and reactive states: https://jujucharms.com/docs/stable/developer-event-cycle

Testing overview: https://jujucharms.com/docs/stable/developer-testing

TODO: There are tools for running tests completely in a container: https://github.com/juju-solutions/charmbox
We'd need to set up the container to hit a non-local environment because we need that to be able to test a snap.

Automated testing is still a WIP

NOTE: Running the test setup will install system packages.

NOTE: you need to have juju2 installed and have a cloud environment setup.

Manual steps to run tests::

juju add-model s2-test
charm build -s xenial
cd $JUJU_REPOSITORY/xenial/submission-service
tests/00-setup
tests/10-deploy

WARNING: The test frequently times out before finishing. This is probably due to the slowness of my cloud environment.

Contact Information

project https://launchpad.net/hexr
bug tracker https://bugs.launchpad.net/hexr


Configuration

c3_api_key
(string) Certification API key
c3_status_url
(string) Certification status URL
https://certification.canonical.com/submissions/status/
c3_submission_url
(string) Certification submission URL
https://certification.canonical.com/api/v1/submit/submission
c3_user
(string) Certification user
snap_proxy
(string) HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
snap_store_proxy
(string) Proxy server for accessing the snap store. Optional.
submission_environment
(string) A label for the environment where the service is deployed
dev
submission_service_port
(int) Port of the Submission Service
8080
submission_version
(string) Version of the service
1.0
swift_api_key
(string) Swift API key
swift_auth_url
(string) Swift Auth URL
swift_container
(string) Name of Swift container where submissions are stored
swift_region
(string) Swift region
swift_tenant
(string) Swift tenant
swift_user
(string) Swift username