On a day-to-day basis, continuous deployment is designed to be used through the GUI.

However, when setting up and when you require more information or flexibility than the GUI provides, fluxctl provides a comprehensive API. The --help command for fluxctl is described below. You will need to set $WEAVE_CLOUD_TOKEN in your shell environment.

Workflow:
  fluxctl list-services                                        # Which services are running?
  fluxctl list-images --service=default/foo                    # Which images are running/available?
  fluxctl release --service=default/foo --update-image=bar:v2  # Release new version.

Usage:
  fluxctl [command]

Available Commands:
  automate      Turn on automatic deployment for a service.
  deautomate    Turn off automatic deployment for a service.
  identity      Display SSH public key
  list-images   Show the deployed and available images for a service.
  list-services List services currently running on the platform.
  lock          Lock a service, so it cannot be deployed.
  policy        Manage policies for a service.
  release       Release a new version of a service.
  save          save service definitions to local files in platform-native format
  unlock        Unlock a service, so it can be deployed.
  version       Output the version of fluxctl

Flags:
  -t, --token string   Weave Cloud service token; you can also set the environment variable WEAVE_CLOUD_TOKEN or FLUX_SERVICE_TOKEN
  -u, --url string     base URL of the flux service; you can also set the environment variable FLUX_URL (default "https://cloud.weave.works/api/flux")

Use "fluxctl [command] --help" for more information about a command.

Viewing Services

The first thing to do is to check whether Flux can see any running services.

To do this, use the list-services subcommand:

$ fluxctl list-services                   

SERVICE                           CONTAINER     IMAGE                                      RELEASE  POLICY
default/kubernetes                                                                                  
kube-system/weave-cortex-agent    agent         prom/prometheus:v1.7.1                     ready    
kube-system/weave-flux-memcached  memcached     memcached:1.4.25                           ready    
sock-shop/carts                   carts         weaveworksdemos/carts:0.4.8                ready    
sock-shop/carts-db                carts-db      mongo:latest                               ready    
sock-shop/catalogue               catalogue     weaveworksdemos/catalogue:0.3.5            ready    
sock-shop/catalogue-db            catalogue-db  weaveworksdemos/catalogue-db:0.3.0         ready    
sock-shop/front-end               front-end     weaveworksdemos/front-end:master-82ebb7c9  ready    
sock-shop/orders                  orders        weaveworksdemos/orders:0.4.7               ready    
sock-shop/orders-db               orders-db     mongo:latest                               ready    
sock-shop/payment                 payment       weaveworksdemos/payment:0.4.3              ready    
sock-shop/queue-master            queue-master  weaveworksdemos/queue-master:0.3.1         ready    
sock-shop/rabbitmq                rabbitmq      rabbitmq:3.6.8                             ready    
sock-shop/session-db              session-db    redis:alpine                               ready    
sock-shop/shipping                shipping      weaveworksdemos/shipping:0.4.8             ready    
sock-shop/user                    user          weaveworksdemos/user:0.4.4                 ready    
sock-shop/user-db                 user-db       weaveworksdemos/user-db:0.3.0              ready  

This command also informs you whether policy has been set on the service to automatically deploy or not.

Inspecting the Version of a Container

With a list of services, you can begin to inspect which versions of the image are running.

$ fluxctl list-images --service sock-shop/front-end 
SERVICE              CONTAINER  IMAGE                                      CREATED
sock-shop/front-end  front-end  index.docker.io/weaveworksdemos/front-end  
                                |   branding                               20 Jun 17 08:59 UTC
                                '-> branding2                              19 Jun 17 13:58 UTC
                                    master-82ebb7c9                        26 May 17 09:05 UTC
                                    red-buttons                            17 Apr 17 18:25 UTC
                                    blue-buttons                           17 Apr 17 18:25 UTC
                                    master-ac9ca707                        07 Apr 17 13:06 UTC
                                    master-3fad5eda                        30 Mar 17 08:51 UTC
                                    master-bdc6f3ff                        29 Mar 17 10:45 UTC
                                    0.3.12                                 21 Mar 17 11:32 UTC
                                    latest                                 21 Mar 17 11:32 UTC

The arrows point to the version that is currently running alongside a list of other versions and their timestamps.

Releasing a Service

Update a service with the release subcommand. This checks whether any images can be updated, and if so, it also writes the new configuration to the repository, and waits for the change to be synchronized to the cluster.

$ fluxctl list-images --service sock-shop/front-end 
SERVICE              CONTAINER  IMAGE                                      CREATED
sock-shop/front-end  front-end  index.docker.io/weaveworksdemos/front-end  
                                |   branding                               20 Jun 17 08:59 UTC
                                '-> branding2                              19 Jun 17 13:58 UTC
                                    master-82ebb7c9                        26 May 17 09:05 UTC
                                    red-buttons                            17 Apr 17 18:25 UTC
                                    blue-buttons                           17 Apr 17 18:25 UTC
                                    master-ac9ca707                        07 Apr 17 13:06 UTC
                                    master-3fad5eda                        30 Mar 17 08:51 UTC
                                    master-bdc6f3ff                        29 Mar 17 10:45 UTC
                                    0.3.12                                 21 Mar 17 11:32 UTC
                                    latest                                 21 Mar 17 11:32 UTC

$ fluxctl release --service=sock-shop/front-end --update-all-images
Submitting release ...
SERVICE              STATUS   UPDATES
sock-shop/front-end  success  front-end: index.docker.io/weaveworksdemos/front-end:branding2 -> branding
Commit pushed:	a63bd1a
Commit applied:	a63bd1a


$ fluxctl list-images --service sock-shop/front-end 
SERVICE              CONTAINER  IMAGE                                      CREATED
sock-shop/front-end  front-end  index.docker.io/weaveworksdemos/front-end  
                                '-> branding                               20 Jun 17 08:59 UTC
                                    branding2                              19 Jun 17 13:58 UTC
                                    master-82ebb7c9                        26 May 17 09:05 UTC
                                    red-buttons                            17 Apr 17 18:25 UTC
                                    blue-buttons                           17 Apr 17 18:25 UTC
                                    master-ac9ca707                        07 Apr 17 13:06 UTC
                                    master-3fad5eda                        30 Mar 17 08:51 UTC
                                    master-bdc6f3ff                        29 Mar 17 10:45 UTC
                                    0.3.12                                 21 Mar 17 11:32 UTC
                                    latest                                 21 Mar 17 11:32 UTC

See fluxctl release --help for more information.

Turning on Automation

Automation can be easily controlled from within Weave Cloud by selecting Deploy and then enabling “Automate” when inspecting a service.

You can also do this with fluxctl using the automate subcommand.

$ fluxctl automate --service sock-shop/front-end 
SERVICE              STATUS   UPDATES
sock-shop/front-end  success  
Commit pushed:	7956c2e


$ fluxctl list-services
SERVICE                           CONTAINER     IMAGE                               RELEASE  POLICY
default/kubernetes                                                                           
kube-system/weave-cortex-agent    agent         prom/prometheus:v1.7.1              ready    
kube-system/weave-flux-memcached  memcached     memcached:1.4.25                    ready    
sock-shop/carts                   carts         weaveworksdemos/carts:0.4.8         ready    
sock-shop/carts-db                carts-db      mongo:latest                        ready    
sock-shop/catalogue               catalogue     weaveworksdemos/catalogue:0.3.5     ready    
sock-shop/catalogue-db            catalogue-db  weaveworksdemos/catalogue-db:0.3.0  ready    
sock-shop/front-end               front-end     weaveworksdemos/front-end:branding  ready    automated
sock-shop/orders                  orders        weaveworksdemos/orders:0.4.7        ready    
sock-shop/orders-db               orders-db     mongo:latest                        ready    
sock-shop/payment                 payment       weaveworksdemos/payment:0.4.3       ready    
sock-shop/queue-master            queue-master  weaveworksdemos/queue-master:0.3.1  ready    
sock-shop/rabbitmq                rabbitmq      rabbitmq:3.6.8                      ready    
sock-shop/session-db              session-db    redis:alpine                        ready    
sock-shop/shipping                shipping      weaveworksdemos/shipping:0.4.8      ready    
sock-shop/user                    user          weaveworksdemos/user:0.4.4          ready    
sock-shop/user-db                 user-db       weaveworksdemos/user-db:0.3.0       ready              

The list-services subcommand reports that the helloworld application is automated. Deploy automatically releases and deploys a new version of a service whenever one is available and also updates the configuration to the version control system.

Further Reading

Managing & Automating Releases