Deploying in proxy mode
This page describes how to deploy the enterprise-store charm in proxy mode, the default mode in which the enterprise-store acts as an edge proxy in front of the global Snap Store. Devices are pointed at the proxy and all traffic to the Store flows through it. The unit needs to be able to reach the Snap Store to install the snap and to proxy requests.
For an airgapped deployment where nothing reaches the internet, see the Offline mode deploy guide instead.
Prerequisites
Controller
A Juju controller on a machine cloud (for example LXD) is required:
sudo snap install juju
sudo snap install lxd
lxd init --auto
juju bootstrap localhost <controller-name>
Registration bundle
The store must be registered with a bundle produced by the
store-admin snap. The bundle contains the
store domain, store_id and the signing keys. Register against the domain
your devices will use:
store-admin register https://store.example.com
This produces a base64 registration bundle. Supply it to the charm through the
registration_bundle config option, either during deployment (via the Juju
bundle or Terraform config shown below) or afterwards on the CLI. For ease of use the
registration file is called registration_bundle.b64, the following command can be used:
juju config enterprise-store \
registration_bundle="$(cat registration_bundle.b64)"
Both methods are supported.
PostgreSQL
The charm requires a PostgreSQL database over the postgresql_client
interface. The enterprise-store needs the btree_gist extension. The charm
requests the superuser role and attempts to provision the extension itself,
but it is recommended to also enable it explicitly on the PostgreSQL charm so
the extension is available regardless of role handling:
juju config postgresql plugin_btree_gist_enable=true
Deploy with the Juju CLI
juju deploy postgresql --channel 14/stable
juju config postgresql plugin_btree_gist_enable=true
juju deploy enterprise-store --channel stable
juju integrate postgresql:database enterprise-store:database
juju config enterprise-store registration_bundle=<registration_bundle.b64>
Deploy with a Juju bundle
applications:
postgresql:
charm: postgresql
channel: 14/stable
num_units: 1
options:
plugin_btree_gist_enable: true
enterprise-store:
charm: enterprise-store
channel: stable
num_units: 1
options:
registration_bundle: <registration_bundle.b64>
relations:
- - postgresql:database
- enterprise-store:database
Deploy with Terraform
The example below uses the juju/juju Terraform provider. Adjust the charm
channel to the one you want to deploy.
terraform {
required_providers {
juju = {
source = "juju/juju"
version = "~> 2.2.1"
}
}
}
provider "juju" {}
resource "juju_model" "proxy-model" {
name = "proxy-model"
cloud {
name = "localhost"
region = "localhost"
}
}
resource "juju_application" "postgresql" {
name = "postgresql"
model_uuid = juju_model.proxy-model.uuid
charm {
name = "postgresql"
channel = "14/stable"
}
config = {
plugin_btree_gist_enable = true
}
}
resource "juju_application" "enterprise-store" {
name = "enterprise-store"
model_uuid = juju_model.proxy-model.uuid
charm {
name = "enterprise-store"
channel = "stable"
}
config = {
registration_bundle = file("${path.module}/registration_bundle.b64")
}
}
resource "juju_integration" "database" {
model_uuid = juju_model.proxy-model.uuid
application {
name = juju_application.postgresql.name
endpoint = "database"
}
application {
name = juju_application.enterprise-store.name
endpoint = "database"
}
}
High availability and TLS
For a highly available deployment (multiple units fronted by haproxy) and for TLS termination options, see the High availability deploy guide.