Skip to content

Service

Duplo cli subcommand to manage services.

Bases: DuploTenantResourceV2

Duplocloud Service Resource

This resource is used to manage services in Duplocloud. Using the duploctl command line tool, you can manage services with actions:

Basic CLI Use
duploctl service <action>

bulk_update_image(serviceimage)

Update multiple services.

Bulk update the image of a services.

Basic CLI Use
duploctl service bulk_update_image -S <service-name-1> <image-name-1> -S <service-name-2> <image-name-2>

Parameters:

Name Type Description Default
serviceimage/-S string

takes n sets of two arguments, service name and image name. e.g -S service1 image1:tag -S service2 image2:tag

required

create(body, wait=False)

Create a service.

current_replicaset(name)

Get the current replicaset for a service.

Parameters:

Name Type Description Default
name str

The name of the service to get replicaset for.

required

Returns: The current replicaset for the service. Raises: DuploError: If the service could not be found.

delete(name)

Delete a service.

find(name)

Find a resource by name.

Parameters:

Name Type Description Default
name NAME

The name of the resource to find.

required

Returns:

Type Description

The resource object.

Raises:

Type Description
DuploError

If the resource could not be found.

image_from_body(body)

Get the image from a service body.

Parameters:

Name Type Description Default
body dict

The body of the service.

required

Returns: The image for the service.

list()

Retrieve a list of all services in a tenant.

logs(name, wait=False)

Get the logs for a service.

pods(name)

Get the pods for a service.

Parameters:

Name Type Description Default
name str

The name of the service to get pods for.

required

Returns: A list of pods for the service. Raises: DuploError: If the service could not be found.

restart(name)

Restart a service.

Restart a service.

Basic CLI Use
duploctl service restart <service-name>

Parameters:

Name Type Description Default
name NAME

The name of the service to restart.

required

Returns:

Type Description

A success message if the service was restarted successfully.

Raises:

Type Description
DuploError

If the service could not be restarted.

start(name)

Start a service.

Start a service.

Basic CLI Use
duploctl service start <service-name>

Parameters:

Name Type Description Default
name str

The name of the service to start.

required

Returns:

Type Description

A success message if the service was started successfully.

Raises:

Type Description
DuploError

If the service could not be started.

stop(name)

Stop a service.

Stop a service.

Basic CLI Use
duploctl service stop <service-name>

Parameters:

Name Type Description Default
name str

The name of the service to stop.

required

Returns:

Type Description

A success message if the service was stopped successfully.

Raises:

Type Description
DuploError

If the service could not be stopped.

update(name, body=None, patches=None, wait=False)

Update a service.

update_env(name, setvar, strategy, deletevar, wait=False)

Update the environment variables of a service.

Parameters:

Name Type Description Default
name str

The name of the service to update.

required
setvar/-V list

A list of key value pairs to set as environment variables.

required
strategy/strat str

The merge strategy to use for env vars. Valid options are "merge" or "replace". Default is merge.

required
deletevar/-D list

A list of keys to delete from the environment variables.

required

update_image(name, image, wait=False)

Update the image of a service.

Update the image of a service.

Basic CLI Use
duploctl service update_image <service-name> <image-name>

Parameters:

Name Type Description Default
name NAME

The name of the service to update.

required
image IMAGE

The new image to use for the service.

required

Returns:

Type Description

Success message

update_replicas(name, replica, wait=False)

Update number of replicas for a service.

Parameters:

Name Type Description Default
name str

The name of the service to update.

required
replica str

Number of replicas to set for service.

required

wait(old, updates)

Wait for a service to update.