Starter project for managing a Replicated Airgapped Kubernetes Appliance or Ship application in a GitHub repo.
make
node
ship
installed. On macOS, you can usebrew install ship
to install with Homebrew- A GitHub repository created to store your Ship application assets.
Note: While Ship supports any git repository, this example leverages features that are GitHub-only (for now). The repo you create can be private or public.
This project contains an example application that can be deployed with ship. The main pieces are
base
-- Kubernetes YAML that defines the applicationscripts
-- Shell scripts to be distributed with the application, primarily for testing and troubleshooting the applicationship.yaml
-- ties these pieces together into a deployable applicationMakefile
-- Workflows for testing the application installation experience- CI integration starters for testing changes to your application.
This repo is a GitHub Template Repository. You can create a private copy by using the "Use this Template" link in the repo:
You should use the template to create a new private repo in your org, for example mycompany/replicated
or mycompany/replicated-starter-ship
.
Once you've created a repository from the template, you'll want to git clone
your new repo and cd
into it locally.
To get started, you'll want to update the following fields in Makefile
and ship.yaml
:
Makefile
REPO
-- update this to the<owner>/<repo>
of your repository on GitHubship.yaml
assets.v1.*.github.repo
-- this should match theREPO
value inMakefile
You can test this out by launching ship with
make run-local
This will open a browser and walk you through configuring the application defined in ship.yaml
. The test application creates a small Kubernetes Deployment to run Nginx, but it's a good way to get a sense of how ship works.
You can inspect the YAML at tmp/rendered.yaml
, and deploy the app using kubectl by running
make deploy-ship
or
kubectl apply -f tmp/rendered.yaml
From here, you can add messaging and configuration options in the config and lifecycle sections of ship.yaml
, and modify YAML in base
to match your kubernetes YAML.
The above
make run-local
task can be run again to see the new changes. To iterate without using the UI, you can use
make run-local-headless
to regenerate assets. State will be stored in tmp/.ship/state.json
between runs, and will persist any changes to config options or Kustomize patches. To deploy it after running, you can
make run-local-headless deploy
To create a release of a Replicated Embedded Kubernetes or Ship app to vendor.replicated.com, you'll need to configure a few additional fields.
- Export your
REPLICATED_API_TOKEN
as described in the kubernetes starter project - Set the following values in your Makefile. See the kubernetes starter project for information on how to get your application ID.
APPLIANCE_APP_ID := CHANGEME
APPLIANCE_CHANNEL := Unstable
SHIP_APP_ID := CHANGEME
SHIP_CHANNEL := Nightly
Then, you can create appliance releases with
make release-appliance
and create ship releases with
make release-ship
The project includes CI configs for Travis CI and CircleCI.
Both configs will lint your ship.yaml
and replicated.yaml
for syntax and logic errors. Once a PR is merged to master, a release will be promoted to the channels designated in your Makefile.
While the Makefile includes a task for release-appliance
, this is still very much a ship-focused starter project.
The optimal workflow for delivering the same Kubernetes manifests to both Ship and Appliance apps will depend greatly on how your team ships code. An example workflow is shown below.
Note: This example asumes you'll be updating your kubernetes manifests in this ship repo manually. Depending on your scale and your process, its possible that your team will instead keep this infrastructure repository up to date automatically. For example, if you have many service repos, you may have core CI jobs for each service push updates to Kubernetes Manifests and image tags in this infrastructure repo as part of your delivery process
MIT
-
Double check the
assets.v1.github
entries in your ship.yaml match the--set-github-contents
flags in yourMakefile
. -
Note that the
make run-local
andmake run-local-headless
tasks don't handle symlinks well. If you have symlinks in your repo, or you've symlinked the repo root, this can cause issues. To determine if this is the cause, you can temporarily replace symlinks with the content they point to.