Git Product home page Git Product logo

cmd's Introduction

Juju logo next to the text Canonical Juju

Juju is an open source application orchestration engine that enables any application operation (deployment, integration, lifecycle management) on any infrastructure (Kubernetes or otherwise) at any scale (development or production) in the same easy way (typically, one line of code), through special operators called β€˜charms’.

juju snap build

πŸ‘‰ Juju Learn how to quickly deploy, integrate, and manage charms on any cloud with Juju.
It's as simple as juju deploy foo, juju integrate foo bar, ..., on any cloud.
Charmhub Sample our existing charms on Charmhub.
A charm can be a cluster (OpenStack, Kubernetes), a data platform (PostgreSQL, MongoDB, etc.), an observability stack (Canonical Observability Stack), an MLOps solution (Kubeflow), and so much more.
Charm SDK Write your own charm!
Juju is written in Go, but our SDK supports easy charm development in Python.

Give it a try!

Let's use Juju to deploy, configure, and integrate some Kubernetes charms:

Set up

You will need a cloud and Juju. The quickest way is to use a Multipass VM launched with the charm-dev blueprint.

Install Multipass: Linux | macOS | Windows. On Linux:

sudo snap install multipass

Use Multipass to launch an Ubuntu VM with the charm-dev blueprint:

multipass launch --cpus 4 --memory 8G --disk 30G --name tutorial-vm charm-dev 

Open a shell into the VM:

multipass shell tutorial-vm

Verify that you have Juju and two localhost clouds:

juju clouds

Bootstrap a Juju controller into the MicroK8s cloud:

juju bootstrap microk8s tutorial-controller

Add a workspace, or 'model':

juju add-model tutorial-model

Deploy, configure, and integrate a few things

Deploy Mattermost:

juju deploy mattermost-k8s

See more: Charmhub | mattermost-k8s

Deploy PostgreSQL:

juju deploy postgresql-k8s --channel 14/stable --trust

See more: Charmhub | postgresql-k8s

Enable security in your PostgreSQL deployment:

juju deploy tls-certificates-operator
juju config tls-certificates-operator generate-self-signed-certificates="true" ca-common-name="Test CA"
juju integrate postgresql-k8s tls-certificates-operator

Integrate Mattermost with PostgreSQL:

juju integrate mattermost-k8s postgresql-k8s:db

Watch your deployment come to life:

juju status --watch 1s

(Press Ctrl-C to quit. Drop the --watch 1s flag to get the status statically. Use the --relations flag to view more information about your integrations.)

Test your deployment

When everything is in active or idle status, note the IP address and port of Mattermost and pass them to curl:

curl <IP address>:<port>/api/v4/system/ping

You should see the output below:

{"AndroidLatestVersion":"","AndroidMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}

Congratulations!

You now have a Kubernetes deployment consisting of a Mattermost backed by PosgreSQL with TLS-encrypted traffic!

Clean up

Delete your Multipass VM:

multipass delete --purge tutorial-vm

Uninstall Multipass: Linux | macOS | Windows. On Linux:

snap remove multipass

Next steps

Learn more

Chat with us

Read our Code of conduct and:

File an issue

Make your mark

cmd's People

Contributors

anastasiamac avatar axw avatar barrettj12 avatar bigjools avatar bz2 avatar davecheney avatar dependabot[bot] avatar ericsnowcurrently avatar evilnick avatar frankban avatar fwereade avatar garyposter avatar howbazaar avatar hpidcock avatar jack-w-shaw avatar jameinel avatar jhobbs avatar jimmiebtlr avatar joseeantonior avatar juanmanuel-tirado avatar jujubot avatar mattyw avatar natefinch avatar niemeyer avatar nightlyone avatar rogpeppe avatar simonrichardson avatar tasdomas avatar themue avatar wallyworld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmd's Issues

Less restrictive license

AGPL is a pretty drastic license for a command-line library. Can we relicense with something less restrictive like BSD?

[documentation command] Ignore subcommand if we have subsubcommands

A nice example of this is juju wait-for. This has 4 subcommands:

  • model
  • application
  • unit
  • machine

Instead, if we encounter a subcommand, with a set of subcommands, then just skip over the initial command and consume the sub-subcommands.

So:

  • juju
    • wait-for
      • model
      • application
      • unit
      • machine

Becomes:

  • juju
    • wait-for model
    • wait-for application
    • wait-for unit
    • wait-for machine

CmdSuite.TestContext failure with go 1.21

Running tests using go 1.21 results in a test failure:

	cd _build && go test -vet=off -v -p 16 github.com/juju/cmd github.com/juju/cmd/cmdtesting
=== RUN   TestPackage

----------------------------------------------------------------------
FAIL: cmd_test.go:41: CmdSuite.TestContext

cmd_test.go:42:
    c.Check(s.ctx.Context, jc.DeepEquals, context.Background())
... obtained context.todoCtx = context.todoCtx{emptyCtx:context.emptyCtx{}} ("context.TODO")
... expected context.backgroundCtx = context.backgroundCtx{emptyCtx:context.emptyCtx{}} ("context.Background")
... mismatch at top level: type mismatch context.todoCtx vs context.backgroundCtx; obtained context.todoCtx{emptyCtx:context.emptyCtx{}}; expected context.backgroundCtx{emptyCtx:context.emptyCtx{}}

OOPS: 122 passed, 1 FAILED
--- FAIL: TestPackage (0.07s)

Debian packaging has applied the following patch:

diff --git a/cmd_test.go b/cmd_test.go
index b4281f7..6df3bbb 100644
--- a/cmd_test.go
+++ b/cmd_test.go
@@ -39,7 +39,7 @@ func (s *CmdSuite) SetUpTest(c *gc.C) {
 }
 
 func (s *CmdSuite) TestContext(c *gc.C) {
-	c.Check(s.ctx.Context, jc.DeepEquals, context.Background())
+	c.Check(s.ctx.Context, jc.DeepEquals, context.TODO())
 	c.Check(s.ctx.AbsPath("/foo/bar"), gc.Equals, "/foo/bar")
 	c.Check(s.ctx.AbsPath("/foo/../bar"), gc.Equals, "/bar")
 	c.Check(s.ctx.AbsPath("foo/bar"), gc.Equals, filepath.Join(s.ctx.Dir, "foo/bar"))

Rename discourse-ids to mapping-ids

This is a breaking change. I'd rather we didn't call out discourse directly here. If someone wants to use something else for mapping, they have to use discourse for no other reason, than we use it.

[documentation command] Don't list help subcommands

See the following documentation: https://juju.is/docs/juju/juju-wait-for

It lists the following subcommands:

application - Wait for an application to reach a specified state.
help        - Show help on a command or other topic.
machine     - Wait for a machine to reach a specified state.
model       - Wait for a model to reach a specified state.
unit        - Wait for a unit to reach a specified state

Unfortunately, we don't want to show help as a subcommand, it's part of the super command type. In this case, we'd want to omit it.

Dependency loop with juju/utils

This library depends on some helper methods from juju/utils, but juju/utils in turn depends on juju/cmd. This forms a dependency loop.

I think the cleanest approach would be to copy over the helper code from juju/utils to break the loop. The methods used from juju/utils are:

  • utils.NormalizePath()
  • utils.Home()

This was noticed while reviewing dependencies needed to cleanly package LXD for Debian, where each library that LXD depends on must be able to build on its own with a clean set of dependencies.

Make documentation an adaptor rather than implicit.

This is another breaking change.

The documentation command should not be instantiated for every command supercommand. Every binary or sub-super command that implements the super command now has a documentation command. This includes things like jujud, container-agent, etc.

Instead, a documentation command should be added to the super command base as an adapter. Ideally, the documentation command should be in a sub-package, so that it can be used in isolation.

An example of this should be:

waitFor := cmd.NewSuperCommand(cmd.SuperCommandParams{
	Name:        "wait-for",
	UsagePrefix: "juju",
	Doc:         waitForDoc,
	Purpose:     "Wait for an entity to reach a specified state.",
	Documentation: documentation.NewMarkdown(),
})

If there is no documentation, it doesn't do anything. This is purely additive.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.