kontena-cli 0.11.7 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/kontena +2 -4
- data/kontena-cli.gemspec +1 -0
- data/lib/kontena/cli/app_command.rb +1 -1
- data/lib/kontena/cli/apps/common.rb +30 -3
- data/lib/kontena/cli/apps/deploy_command.rb +1 -0
- data/lib/kontena/cli/apps/list_command.rb +1 -0
- data/lib/kontena/cli/apps/logs_command.rb +9 -3
- data/lib/kontena/cli/apps/monitor_command.rb +1 -0
- data/lib/kontena/cli/apps/remove_command.rb +2 -0
- data/lib/kontena/cli/apps/scale_command.rb +2 -1
- data/lib/kontena/cli/apps/show_command.rb +1 -0
- data/lib/kontena/cli/apps/start_command.rb +1 -0
- data/lib/kontena/cli/apps/stop_command.rb +1 -0
- data/lib/kontena/cli/common.rb +5 -1
- data/lib/kontena/cli/containers/exec_command.rb +1 -0
- data/lib/kontena/cli/containers/inspect_command.rb +1 -0
- data/lib/kontena/cli/etcd/get_command.rb +2 -1
- data/lib/kontena/cli/etcd/list_command.rb +1 -0
- data/lib/kontena/cli/etcd/mkdir_command.rb +2 -1
- data/lib/kontena/cli/etcd/remove_command.rb +2 -1
- data/lib/kontena/cli/etcd/set_command.rb +2 -1
- data/lib/kontena/cli/etcd_command.rb +2 -2
- data/lib/kontena/cli/external_registries/add_command.rb +1 -0
- data/lib/kontena/cli/external_registries/delete_command.rb +2 -0
- data/lib/kontena/cli/external_registries/list_command.rb +1 -0
- data/lib/kontena/cli/external_registries/remove_command.rb +13 -0
- data/lib/kontena/cli/external_registry_command.rb +4 -3
- data/lib/kontena/cli/grid_command.rb +5 -1
- data/lib/kontena/cli/grid_options.rb +12 -0
- data/lib/kontena/cli/grids/add_user_command.rb +1 -0
- data/lib/kontena/cli/grids/cloud_config_command.rb +41 -0
- data/lib/kontena/cli/grids/common.rb +65 -4
- data/lib/kontena/cli/grids/logs_command.rb +9 -4
- data/lib/kontena/cli/grids/remove_user_command.rb +1 -0
- data/lib/kontena/cli/grids/update_command.rb +27 -0
- data/lib/kontena/cli/master/use_command.rb +12 -2
- data/lib/kontena/cli/master/users/add_role_command.rb +26 -0
- data/lib/kontena/cli/master/users/invite_command.rb +24 -0
- data/lib/kontena/cli/master/users/list_command.rb +18 -0
- data/lib/kontena/cli/master/users/remove_role_command.rb +26 -0
- data/lib/kontena/cli/master/users_command.rb +14 -0
- data/lib/kontena/cli/master_command.rb +2 -1
- data/lib/kontena/cli/node_command.rb +7 -1
- data/lib/kontena/cli/nodes/add_label_command.rb +19 -0
- data/lib/kontena/cli/nodes/aws/create_command.rb +2 -1
- data/lib/kontena/cli/nodes/aws/restart_command.rb +1 -0
- data/lib/kontena/cli/nodes/aws/terminate_command.rb +1 -0
- data/lib/kontena/cli/nodes/azure/create_command.rb +1 -0
- data/lib/kontena/cli/nodes/azure/restart_command.rb +1 -0
- data/lib/kontena/cli/nodes/azure/terminate_command.rb +1 -0
- data/lib/kontena/cli/nodes/digital_ocean/create_command.rb +1 -0
- data/lib/kontena/cli/nodes/digital_ocean/restart_command.rb +1 -0
- data/lib/kontena/cli/nodes/digital_ocean/terminate_command.rb +1 -0
- data/lib/kontena/cli/nodes/list_command.rb +10 -14
- data/lib/kontena/cli/nodes/remove_command.rb +1 -0
- data/lib/kontena/cli/nodes/remove_label_command.rb +23 -0
- data/lib/kontena/cli/nodes/show_command.rb +1 -0
- data/lib/kontena/cli/nodes/ssh_command.rb +1 -0
- data/lib/kontena/cli/nodes/update_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/create_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/restart_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/ssh_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/start_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/stop_command.rb +1 -0
- data/lib/kontena/cli/nodes/vagrant/terminate_command.rb +1 -0
- data/lib/kontena/cli/registry/create_command.rb +80 -30
- data/lib/kontena/cli/registry/delete_command.rb +3 -0
- data/lib/kontena/cli/registry/remove_command.rb +15 -0
- data/lib/kontena/cli/registry_command.rb +3 -1
- data/lib/kontena/cli/service_command.rb +20 -4
- data/lib/kontena/cli/services/add_env_command.rb +1 -0
- data/lib/kontena/cli/services/add_secret_command.rb +24 -0
- data/lib/kontena/cli/services/containers_command.rb +1 -0
- data/lib/kontena/cli/services/create_command.rb +3 -2
- data/lib/kontena/cli/services/delete_command.rb +2 -0
- data/lib/kontena/cli/services/deploy_command.rb +1 -0
- data/lib/kontena/cli/services/envs_command.rb +1 -0
- data/lib/kontena/cli/services/link_command.rb +26 -0
- data/lib/kontena/cli/services/list_command.rb +13 -10
- data/lib/kontena/cli/services/logs_command.rb +13 -5
- data/lib/kontena/cli/services/monitor_command.rb +1 -0
- data/lib/kontena/cli/services/remove_command.rb +17 -0
- data/lib/kontena/cli/services/remove_env_command.rb +1 -0
- data/lib/kontena/cli/services/remove_secret_command.rb +28 -0
- data/lib/kontena/cli/services/restart_command.rb +1 -0
- data/lib/kontena/cli/services/scale_command.rb +2 -1
- data/lib/kontena/cli/services/show_command.rb +1 -0
- data/lib/kontena/cli/services/start_command.rb +1 -0
- data/lib/kontena/cli/services/stats_command.rb +5 -4
- data/lib/kontena/cli/services/stop_command.rb +1 -0
- data/lib/kontena/cli/services/unlink_command.rb +25 -0
- data/lib/kontena/cli/services/update_command.rb +4 -3
- data/lib/kontena/cli/users_command.rb +15 -0
- data/lib/kontena/cli/vault/list_command.rb +1 -0
- data/lib/kontena/cli/vault/read_command.rb +1 -0
- data/lib/kontena/cli/vault/remove_command.rb +1 -0
- data/lib/kontena/cli/vault/write_command.rb +1 -0
- data/lib/kontena/cli/version_command.rb +9 -1
- data/lib/kontena/cli/vpn/config_command.rb +1 -0
- data/lib/kontena/cli/vpn/create_command.rb +1 -0
- data/lib/kontena/cli/vpn/delete_command.rb +2 -0
- data/lib/kontena/cli/vpn/remove_command.rb +15 -0
- data/lib/kontena/cli/vpn_command.rb +3 -1
- data/lib/kontena/machine/aws/node_destroyer.rb +1 -1
- data/lib/kontena/machine/cloud_config/cloudinit.yml +70 -0
- data/lib/kontena/machine/cloud_config/node_generator.rb +28 -0
- data/lib/kontena/machine/digital_ocean/cloudinit.yml +22 -0
- data/lib/kontena/machine/digital_ocean/node_destroyer.rb +4 -2
- data/lib/kontena/machine/random_name.rb +3 -3
- data/lib/kontena/scripts/completer +7 -3
- data/spec/fixtures/docker-compose.yml +8 -0
- data/spec/fixtures/kontena.yml +17 -0
- data/spec/fixtures/mysql.yml +3 -0
- data/spec/fixtures/wordpress-scaled.yml +3 -0
- data/spec/fixtures/wordpress.yml +2 -0
- data/spec/kontena/cli/app/common_spec.rb +42 -0
- data/spec/kontena/cli/app/deploy_command_spec.rb +4 -31
- data/spec/kontena/cli/app/scale_spec.rb +4 -23
- data/spec/kontena/cli/master/use_command_spec.rb +12 -3
- data/spec/kontena/cli/master/users/add_role_command_spec.rb +35 -0
- data/spec/kontena/cli/master/users/invite_command_spec.rb +35 -0
- data/spec/kontena/cli/master/users/remove_role_command_spec.rb +35 -0
- data/spec/kontena/cli/services/add_secret_command_spec.rb +61 -0
- data/spec/kontena/cli/services/link_command_spec.rb +43 -0
- data/spec/kontena/cli/services/remove_secret_command_spec.rb +48 -0
- data/spec/kontena/cli/services/restart_command_spec.rb +1 -23
- data/spec/kontena/cli/services/unlink_command_spec.rb +43 -0
- data/spec/kontena/cli/version_command_spec.rb +17 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/support/client_helpers.rb +31 -0
- data/spec/support/fixtures_helpers.rb +7 -0
- metadata +67 -6
- data/lib/kontena/cli/deploy_command.rb +0 -164
- data/lib/kontena/cli/invite_command.rb +0 -13
- data/spec/kontena/cli/deploy_command_spec.rb +0 -239
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../grid_options'
|
2
|
+
require_relative 'services_helper'
|
3
|
+
|
4
|
+
module Kontena::Cli::Services
|
5
|
+
class UnlinkCommand < Clamp::Command
|
6
|
+
include Kontena::Cli::Common
|
7
|
+
include Kontena::Cli::GridOptions
|
8
|
+
include ServicesHelper
|
9
|
+
|
10
|
+
parameter "NAME", "Service name"
|
11
|
+
parameter "TARGET", "Link target service name"
|
12
|
+
|
13
|
+
def execute
|
14
|
+
require_api_url
|
15
|
+
token = require_token
|
16
|
+
|
17
|
+
service = client(token).get("services/#{parse_service_id(name)}")
|
18
|
+
links = service['links'].map{|l| {name: l['grid_service_id'].split('/')[1], alias: l['alias']} }
|
19
|
+
abort("Service is not linked to #{target.to_s}") unless links.find{|l| l[:name] == target.to_s}
|
20
|
+
links.delete_if{|l| l[:name] == target.to_s}
|
21
|
+
data = {links: links}
|
22
|
+
update_service(token, name, data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,6 +3,7 @@ require_relative 'services_helper'
|
|
3
3
|
module Kontena::Cli::Services
|
4
4
|
class UpdateCommand < Clamp::Command
|
5
5
|
include Kontena::Cli::Common
|
6
|
+
include Kontena::Cli::GridOptions
|
6
7
|
include ServicesHelper
|
7
8
|
|
8
9
|
parameter "NAME", "Service name"
|
@@ -24,11 +25,11 @@ module Kontena::Cli::Services
|
|
24
25
|
option "--net", "NET", "Network mode"
|
25
26
|
option "--log-driver", "LOG_DRIVER", "Set logging driver"
|
26
27
|
option "--log-opt", "LOG_OPT", "Add logging options", multivalued: true
|
27
|
-
option "--deploy-strategy", "STRATEGY", "Deploy strategy to use (ha, random)"
|
28
|
+
option "--deploy-strategy", "STRATEGY", "Deploy strategy to use (ha, daemon, random)"
|
28
29
|
option "--deploy-wait-for-port", "PORT", "Wait for port to respond when deploying"
|
29
30
|
option "--deploy-min-health", "FLOAT", "The minimum percentage (0.0 - 1.0) of healthy instances that do not sacrifice overall service availability while deploying"
|
30
31
|
option "--pid", "PID", "Pid namespace to use"
|
31
|
-
option "--secret", "SECRET", "Import secret from Vault", multivalued: true
|
32
|
+
option "--secret", "SECRET", "Import secret from Vault (format: <secret>:<name>:<type>)", multivalued: true
|
32
33
|
|
33
34
|
def execute
|
34
35
|
require_api_url
|
@@ -51,7 +52,7 @@ module Kontena::Cli::Services
|
|
51
52
|
data[:cpu_shares] = cpu_shares if cpu_shares
|
52
53
|
data[:affinity] = affinity_list unless affinity_list.empty?
|
53
54
|
data[:env] = env_list unless env_list.empty?
|
54
|
-
data[:secrets] = parse_secrets(secret_list)
|
55
|
+
data[:secrets] = parse_secrets(secret_list) unless secret_list.empty?
|
55
56
|
data[:container_count] = instances if instances
|
56
57
|
data[:cmd] = cmd.split(" ") if cmd
|
57
58
|
data[:user] = user if user
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'users/invite_command'
|
2
|
+
require_relative 'users/list_command'
|
3
|
+
require_relative 'users/add_role_command'
|
4
|
+
require_relative 'users/remove_role_command'
|
5
|
+
|
6
|
+
class Kontena::Cli::UsersCommand < Clamp::Command
|
7
|
+
|
8
|
+
subcommand "invite", "Invite user to Kontena Master", Kontena::Cli::Users::InviteCommand
|
9
|
+
subcommand ["list", "ls"], "List users", Kontena::Cli::Users::ListCommand
|
10
|
+
subcommand "add-role", "Add role to user", Kontena::Cli::Users::AddRoleCommand
|
11
|
+
subcommand "remove-role", "Remove role from user", Kontena::Cli::Users::RemoveRoleCommand
|
12
|
+
|
13
|
+
def execute
|
14
|
+
end
|
15
|
+
end
|
@@ -1,8 +1,16 @@
|
|
1
1
|
require_relative 'version'
|
2
2
|
|
3
3
|
class Kontena::Cli::VersionCommand < Clamp::Command
|
4
|
+
include Kontena::Cli::Common
|
4
5
|
|
5
6
|
def execute
|
6
|
-
|
7
|
+
url = api_url rescue nil
|
8
|
+
puts "cli: #{Kontena::Cli::VERSION}"
|
9
|
+
if url
|
10
|
+
resp = JSON.parse(client.http_client.get(path: '/').body) rescue nil
|
11
|
+
if resp
|
12
|
+
puts "master: #{resp['version']} (#{url})"
|
13
|
+
end
|
14
|
+
end
|
7
15
|
end
|
8
16
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Kontena::Cli::Vpn
|
2
2
|
class DeleteCommand < Clamp::Command
|
3
3
|
include Kontena::Cli::Common
|
4
|
+
include Kontena::Cli::GridOptions
|
4
5
|
|
5
6
|
def execute
|
7
|
+
puts "DEPRECATION WARNING: Support for 'kontena vpn delete' will be dropped. Use 'kontena vpn remove' instead.".colorize(:red)
|
6
8
|
require_api_url
|
7
9
|
token = require_token
|
8
10
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Kontena::Cli::Vpn
|
2
|
+
class RemoveCommand < Clamp::Command
|
3
|
+
include Kontena::Cli::Common
|
4
|
+
|
5
|
+
def execute
|
6
|
+
require_api_url
|
7
|
+
token = require_token
|
8
|
+
|
9
|
+
vpn = client(token).get("services/#{current_grid}/vpn") rescue nil
|
10
|
+
abort("VPN service does not exist") if vpn.nil?
|
11
|
+
|
12
|
+
client(token).delete("services/#{current_grid}/vpn")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require_relative 'vpn/create_command'
|
2
2
|
require_relative 'vpn/config_command'
|
3
|
+
require_relative 'vpn/remove_command'
|
3
4
|
require_relative 'vpn/delete_command'
|
4
5
|
|
5
6
|
class Kontena::Cli::VpnCommand < Clamp::Command
|
6
7
|
|
7
8
|
subcommand "create", "Create VPN service", Kontena::Cli::Vpn::CreateCommand
|
8
9
|
subcommand "config", "Show/Export VPN config", Kontena::Cli::Vpn::ConfigCommand
|
9
|
-
subcommand "
|
10
|
+
subcommand ["remove", "rm"], "Remove VPN service", Kontena::Cli::Vpn::RemoveCommand
|
11
|
+
subcommand "delete", "[DEPRECATED] Delete VPN service", Kontena::Cli::Vpn::DeleteCommand
|
10
12
|
|
11
13
|
def execute
|
12
14
|
end
|
@@ -17,7 +17,7 @@ module Kontena
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def run!(grid, name)
|
20
|
-
instance = client.servers.all({'tag:
|
20
|
+
instance = client.servers.all({'tag:Name' => name}).first
|
21
21
|
if instance
|
22
22
|
ShellSpinner "Terminating AWS instance #{name.colorize(:cyan)} " do
|
23
23
|
instance.destroy
|
@@ -0,0 +1,70 @@
|
|
1
|
+
#cloud-config
|
2
|
+
write_files:
|
3
|
+
- path: /etc/kontena-agent.env
|
4
|
+
permissions: 0600
|
5
|
+
owner: root
|
6
|
+
content: |
|
7
|
+
KONTENA_URI="<%= master_uri %>"
|
8
|
+
KONTENA_TOKEN="<%= grid_token %>"
|
9
|
+
KONTENA_PEER_INTERFACE=<%= peer_interface %>
|
10
|
+
KONTENA_VERSION=<%= version %>
|
11
|
+
- path: /etc/systemd/system/docker.service.d/50-kontena.conf
|
12
|
+
content: |
|
13
|
+
[Service]
|
14
|
+
Environment='DOCKER_OPTS=--insecure-registry="10.81.0.0/19" --bip="<%= docker_bip %>"'
|
15
|
+
- path: /etc/sysctl.d/99-inotify.conf
|
16
|
+
owner: root
|
17
|
+
permissions: 0644
|
18
|
+
content: |
|
19
|
+
fs.inotify.max_user_instances = 8192
|
20
|
+
coreos:
|
21
|
+
units:
|
22
|
+
- name: 00-eth.network
|
23
|
+
runtime: true
|
24
|
+
content: |
|
25
|
+
[Match]
|
26
|
+
Name=eth*
|
27
|
+
[Network]
|
28
|
+
DHCP=yes
|
29
|
+
<% dns_servers.each do |dns| %>DNS=<%= dns %>
|
30
|
+
<% end %>
|
31
|
+
DOMAINS=kontena.local
|
32
|
+
[DHCP]
|
33
|
+
UseDNS=false
|
34
|
+
|
35
|
+
- name: 10-weave.network
|
36
|
+
runtime: false
|
37
|
+
content: |
|
38
|
+
[Match]
|
39
|
+
Type=bridge
|
40
|
+
Name=weave*
|
41
|
+
|
42
|
+
[Network]
|
43
|
+
- name: kontena-agent.service
|
44
|
+
command: start
|
45
|
+
enable: true
|
46
|
+
content: |
|
47
|
+
[Unit]
|
48
|
+
Description=kontena-agent
|
49
|
+
After=network-online.target
|
50
|
+
After=docker.service
|
51
|
+
Description=Kontena Agent
|
52
|
+
Documentation=http://www.kontena.io/
|
53
|
+
Requires=network-online.target
|
54
|
+
Requires=docker.service
|
55
|
+
|
56
|
+
[Service]
|
57
|
+
Restart=always
|
58
|
+
RestartSec=5
|
59
|
+
EnvironmentFile=/etc/kontena-agent.env
|
60
|
+
ExecStartPre=-/usr/bin/docker stop kontena-agent
|
61
|
+
ExecStartPre=-/usr/bin/docker rm kontena-agent
|
62
|
+
ExecStartPre=/usr/bin/docker pull kontena/agent:${KONTENA_VERSION}
|
63
|
+
ExecStart=/usr/bin/docker run --name kontena-agent \
|
64
|
+
-e KONTENA_URI=${KONTENA_URI} \
|
65
|
+
-e KONTENA_TOKEN=${KONTENA_TOKEN} \
|
66
|
+
-e KONTENA_PEER_INTERFACE=${KONTENA_PEER_INTERFACE} \
|
67
|
+
-v=/var/run/docker.sock:/var/run/docker.sock \
|
68
|
+
-v=/etc/kontena-agent.env:/etc/kontena.env \
|
69
|
+
--net=host \
|
70
|
+
kontena/agent:${KONTENA_VERSION}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'erb'
|
3
|
+
|
4
|
+
module Kontena
|
5
|
+
module Machine
|
6
|
+
module CloudConfig
|
7
|
+
class NodeGenerator
|
8
|
+
|
9
|
+
# @param [Hash] opts
|
10
|
+
def generate(opts)
|
11
|
+
user_data(opts)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [Hash] vars
|
15
|
+
def user_data(vars)
|
16
|
+
cloudinit_template = File.join(__dir__ , '/cloudinit.yml')
|
17
|
+
erb(File.read(cloudinit_template), vars)
|
18
|
+
end
|
19
|
+
|
20
|
+
# @param [String] template
|
21
|
+
# @param [Hash] vars
|
22
|
+
def erb(template, vars)
|
23
|
+
ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -24,6 +24,13 @@ write_files:
|
|
24
24
|
nameserver 172.17.43.1
|
25
25
|
nameserver 8.8.8.8
|
26
26
|
nameserver 8.8.4.4
|
27
|
+
- path: /opt/bin/floating_ip.sh
|
28
|
+
permissions: 0755
|
29
|
+
owner: root
|
30
|
+
content: |
|
31
|
+
#!/bin/sh
|
32
|
+
IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address)
|
33
|
+
/usr/bin/ip addr add $IP/16 dev eth0
|
27
34
|
coreos:
|
28
35
|
units:
|
29
36
|
- name: 10-weave.network
|
@@ -34,6 +41,21 @@ coreos:
|
|
34
41
|
Name=weave*
|
35
42
|
|
36
43
|
[Network]
|
44
|
+
- name: floating-ip.service
|
45
|
+
command: start
|
46
|
+
enable: true
|
47
|
+
content: |
|
48
|
+
[Unit]
|
49
|
+
Description=floating-ip
|
50
|
+
After=network-online.target
|
51
|
+
Description=DigitalOcean Floating IP
|
52
|
+
Documentation=https://www.digitalocean.com/community/tutorials/how-to-enable-floating-ips-on-an-older-droplet#coreos
|
53
|
+
Requires=network-online.target
|
54
|
+
|
55
|
+
[Service]
|
56
|
+
Type=oneshot
|
57
|
+
RemainAfterExit=yes
|
58
|
+
ExecStart=/opt/bin/floating_ip.sh
|
37
59
|
- name: kontena-agent.service
|
38
60
|
command: start
|
39
61
|
enable: true
|
@@ -19,8 +19,10 @@ module Kontena
|
|
19
19
|
droplet = client.droplets.all.find{|d| d.name == name}
|
20
20
|
if droplet
|
21
21
|
ShellSpinner "Terminating DigitalOcean droplet #{name.colorize(:cyan)} " do
|
22
|
-
client.droplets.delete(id: droplet.id)
|
23
|
-
|
22
|
+
result = client.droplets.delete(id: droplet.id)
|
23
|
+
if result.is_a?(String)
|
24
|
+
abort "Cannot delete droplet #{name.colorize(:cyan)} in DigitalOcean"
|
25
|
+
end
|
24
26
|
end
|
25
27
|
else
|
26
28
|
abort "Cannot find droplet #{name.colorize(:cyan)} in DigitalOcean"
|
@@ -3,9 +3,9 @@ module Kontena
|
|
3
3
|
module RandomName
|
4
4
|
|
5
5
|
def generate_name
|
6
|
-
|
7
|
-
|
8
|
-
"#{adjectives[
|
6
|
+
rnd1 = Random.rand(64)
|
7
|
+
rnd2 = Random.rand(64)
|
8
|
+
"#{adjectives[rnd1%adjectives.length]}-#{nouns[rnd2%adjectives.length]}"
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -81,7 +81,7 @@ words = ARGV
|
|
81
81
|
words.delete_at(0)
|
82
82
|
|
83
83
|
completion = []
|
84
|
-
completion.push %w(app deploy forgot-password master node grid
|
84
|
+
completion.push %w(app deploy forgot-password master node grid service container vpn external-registry registry login logout whoami) if words.size < 2
|
85
85
|
if words.size > 0
|
86
86
|
case words[0]
|
87
87
|
when 'grid'
|
@@ -104,9 +104,12 @@ if words.size > 0
|
|
104
104
|
end
|
105
105
|
when 'master'
|
106
106
|
completion.clear
|
107
|
-
sub_commands = %w(list use vagrant digitalocean azure aws)
|
107
|
+
sub_commands = %w(list use vagrant digitalocean azure aws users)
|
108
108
|
if words[1] && words[1] == 'use'
|
109
109
|
completion.push helper.master_names
|
110
|
+
elsif words[1] && words[1] == 'users'
|
111
|
+
users_sub_commands = %(invite list add-role remove-role)
|
112
|
+
completion.push users_sub_commands
|
110
113
|
elsif words[1]
|
111
114
|
completion.push(sub_commands) unless sub_commands.include?(words[1])
|
112
115
|
completion.push %w(create)
|
@@ -116,7 +119,8 @@ if words.size > 0
|
|
116
119
|
when 'service'
|
117
120
|
completion.clear
|
118
121
|
sub_commands = %w(containers create delete deploy list logs restart
|
119
|
-
scale show start stats stop update monitor
|
122
|
+
scale show start stats stop update monitor envs
|
123
|
+
add-env remove-env add-secret remove-secret)
|
120
124
|
if words[1]
|
121
125
|
completion.push(sub_commands) unless sub_commands.include?(words[1])
|
122
126
|
completion.push helper.services
|
@@ -0,0 +1,17 @@
|
|
1
|
+
wordpress:
|
2
|
+
extends:
|
3
|
+
file: docker-compose.yml
|
4
|
+
service: wordpress
|
5
|
+
stateful: true
|
6
|
+
environment:
|
7
|
+
- WORDPRESS_DB_PASSWORD=%{project}_secret
|
8
|
+
instances: 2
|
9
|
+
deploy:
|
10
|
+
strategy: ha
|
11
|
+
mysql:
|
12
|
+
extends:
|
13
|
+
file: docker-compose.yml
|
14
|
+
service: mysql
|
15
|
+
stateful: true
|
16
|
+
environment:
|
17
|
+
- MYSQL_ROOT_PASSWORD=%{project}_secret
|