-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace swarm script with AMP CLI #455
Conversation
23842b1
to
a178652
Compare
Aliases: []string{"amp-agent"}, | ||
}, | ||
}, | ||
}, "nats", "influxdb") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nats is not an upstream dependency of telegraf-agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -0,0 +1,41 @@ | |||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename the file to platform_status.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
if s.force { | ||
s.printf(colWarn, "Force mode: on\n") | ||
} | ||
defaultHeaders := map[string]string{"User-Agent": "amplifier-1.0"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we use the version from the binary instead? (at build time there's a VERSION env variable available)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, it should have version here
for _, name := range stack.volumesToRemove { | ||
s.removeVolume(name) | ||
} | ||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a risk of infinite loop, should't we limit the retries and fail if it wasn't able to start all the services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
if err != nil { | ||
return err | ||
} | ||
//Verify fist that it exists at least one container running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/it exists/there's/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
} | ||
} | ||
service.failed = false | ||
//No container running and failling then service is still starting without error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/failling/failing/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
} | ||
|
||
func (s *ampManager) forceService(service *ampService) { | ||
s.printf(colWarn, "Force mode: service %s is concidered as ready\n", service.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/concidered/considered/
and I think it would be better to say "status of service %s is forced to 'ready'\n"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
s.docker.VolumeRemove(s.ctx, name, true) | ||
ret, err := s.docker.VolumeList(s.ctx, filter) | ||
if err == nil { | ||
return fmt.Errorf("Impossible to get volume list: %v\n", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Impossible/Failed/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
if err != nil { | ||
s.printf(colError, "image %s pull error: %v\n", image, err) | ||
} | ||
data := make([]byte, 1000, 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if the stack is big enough to fill the array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not possible, it's not related to stack but to the reader which adjust data to the array size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
RootCmd.AddCommand(PlatformPull) | ||
} | ||
|
||
func pullAMPImages(cmd *cobra.Command, args []string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amp pull --server=remote-server:8080 pulls images locally, which doesn't make any sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be improved later, --server is a amp persistent flag which have nothing to do with pull for this PR concidering we wanted to have commands separated from amp code and so from amplifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree, the --server (or the .amp.yaml config) is a configuration for all command of this binary. It should apply to the pull command. If I configure the CLI to manage an infra stack on a remote swarm manager, I don't want it to pull images locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i got that, but it's not the target of the PR for now. Added error when --server is used with pull
1664b8f
to
2f6268f
Compare
- ./swarm pull --min | ||
- ./swarm start --min | ||
- amp pull | ||
- appp start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it amp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -214,8 +214,8 @@ func (s *ampManager) monitor(stack *ampStack) { | |||
cols[2] = len(serv.status) + 2 | |||
} | |||
} | |||
fmt.Printf("%s%s%s%s%s\n", col("ID", cols[0]), col("SERVICE", cols[1]), col("STATUS", cols[2]), col("MODE", cols[3]), col("REPLICAS", cols[4])) | |||
fmt.Printf("%s%s%s%s%s\n", col("-", cols[0]), col("-", cols[1]), col("-", cols[2]), col("-", cols[3]), col("-", cols[4])) | |||
fmt.Printf("%s%s%s%s%s%s\n", col("ID", cols[0]), col("SERVICE", cols[1]), col("STATUS", cols[2]), col("MODE", cols[3]), col("REPLICAS", cols[4]), col("TASK FAILED", cols[5])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/TASK FAILED/FAILED TASKS/
dfc2ebd
to
1358adc
Compare
- ./swarm start --min | ||
- make install | ||
- amp pull | ||
- app start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is app? Shouldn't it be amp?
d1cf1ce
to
86d56ff
Compare
126c593
to
8575c37
Compare
c3b6ea9
to
d0a6529
Compare
related to #437
add amp platform commands: ([-v]: verbose, [-s]:silence, [f]: force
or using alias
pf
as:tested on ubuntu and os/x
tests:
amp platform stop
amp platform pull -v
: pull all images needed for amp (-v: to have details)amp platform monitor
in another console to monitor ampamp platform start -v
in the first console-execute:
amp platform status
it returns 'running'make test
amp platform stop