Skip to content
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

Cli: Stop containers #167

Merged
merged 1 commit into from Oct 19, 2020
Merged

Cli: Stop containers #167

merged 1 commit into from Oct 19, 2020

Conversation

cenouralm
Copy link
Contributor

No description provided.

@cenouralm cenouralm self-assigned this Oct 16, 2020
@cenouralm cenouralm linked an issue Oct 16, 2020 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Oct 16, 2020

Coverage Status

Coverage decreased (-0.2%) to 86.028% when pulling 11d0db5 on cenouralm:stop_local_fixed into be04439 on inveniosoftware:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 86.083% when pulling 346118f on cenouralm:stop_local_fixed into be04439 on inveniosoftware:master.

@cenouralm cenouralm marked this pull request as ready for review October 16, 2020 13:50
@@ -108,7 +108,7 @@ def containerize(pre, force, install_js, stop):
DockerHelper(cli_config.get_project_shortname(), local=False)
)

commands.containerize(pre=pre, force=force, install=install_js, stop=stop)
commands.containerize(pre=pre, force=force, install=install_js)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major: cannot comment on those lines. should remove stop argument and click option, since it is not used anymore inside this command?

@@ -156,6 +156,16 @@ def destroy(verbose):
commands.destroy()


@cli.command()
@click.option('--verbose', default=False, is_flag=True, required=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moderate: This option is not used anywhere right? I think is a legacy from when we tried logging the output, might not be needed for now (I think is better to remove).

def stop(self):
"""Stops containers."""
self.docker_helper.stop_containers()
click.secho('Stopped containers', fg='green')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ultra-mega-ocd, feel free to ignore: All the actions in the other commands are being logged before happening (that way if something goes wrong the user knows where, is not just "a hung up call". Same applies to destroy below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I fully understood what you meant... Could you explain a bit further?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other commands (e.g. when destroying indices or whatever), the message is sechoed before executing:

secho... # Tell the user it's gonna happen
docker_helper...  # Make it happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope it is better now :)

@ppanero
Copy link
Member

ppanero commented Oct 19, 2020

Works as expected:

(stats) ~/Workspace/inveniosw/test/my-site docker ps -a
CONTAINER ID        IMAGE                                                     COMMAND                  CREATED             STATUS                          PORTS                                                                                                         NAMES
b3e31a5988e3        my-site-frontend                                          "/docker-entrypoint.…"   3 minutes ago       Up 3 minutes                    0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:32771->80/tcp, 0.0.0.0:32770->443/tcp                       my-site_frontend_1
b8e6fe52760f        my-site                                                   "bash -c 'celery wor…"   3 minutes ago       Restarting (2) 13 seconds ago                                                                                                                 my-site_worker_1
3551e2ded03d        my-site                                                   "bash -c 'uwsgi /opt…"   3 minutes ago       Up 3 minutes                    0.0.0.0:32769->5000/tcp                                                                                       my-site_web-ui_1
934105194ab3        my-site                                                   "bash -c 'uwsgi /opt…"   3 minutes ago       Up 3 minutes                    0.0.0.0:32768->5000/tcp                                                                                       my-site_web-api_1
6ec5ed0695b2        rabbitmq:3-management                                     "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes                    4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   my-site_mq_1
2d3227ad4c40        docker.elastic.co/elasticsearch/elasticsearch-oss:7.2.0   "/usr/local/bin/dock…"   3 minutes ago       Up 3 minutes (healthy)          0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp                                                                my-site_es_1
ca19a22b2733        redis                                                     "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes                    0.0.0.0:6379->6379/tcp                                                                                        my-site_cache_1
02e42c13b9ff        postgres:9.6                                              "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes                    0.0.0.0:5432->5432/tcp                                                                                        my-site_db_1
(stats) ~/Workspace/inveniosw/test/my-site invenio-cli stop
Stopping containers...
Stopping my-site_frontend_1 ... done
Stopping my-site_worker_1   ... done
Stopping my-site_web-ui_1   ... done
Stopping my-site_web-api_1  ... done
Stopping my-site_mq_1       ... done
Stopping my-site_es_1       ... done
Stopping my-site_cache_1    ... done
Stopping my-site_db_1       ... done
Stopped containers
(stats) ~/Workspace/inveniosw/test/my-site docker ps -a
CONTAINER ID        IMAGE                                                     COMMAND                  CREATED             STATUS                       PORTS               NAMES
b3e31a5988e3        my-site-frontend                                          "/docker-entrypoint.…"   3 minutes ago       Exited (0) 9 seconds ago                         my-site_frontend_1
b8e6fe52760f        my-site                                                   "bash -c 'celery wor…"   3 minutes ago       Exited (2) 35 seconds ago                        my-site_worker_1
3551e2ded03d        my-site                                                   "bash -c 'uwsgi /opt…"   3 minutes ago       Exited (0) 8 seconds ago                         my-site_web-ui_1
934105194ab3        my-site                                                   "bash -c 'uwsgi /opt…"   3 minutes ago       Exited (0) 8 seconds ago                         my-site_web-api_1
6ec5ed0695b2        rabbitmq:3-management                                     "docker-entrypoint.s…"   3 minutes ago       Exited (0) 3 seconds ago                         my-site_mq_1
2d3227ad4c40        docker.elastic.co/elasticsearch/elasticsearch-oss:7.2.0   "/usr/local/bin/dock…"   3 minutes ago       Exited (143) 7 seconds ago                       my-site_es_1
ca19a22b2733        redis                                                     "docker-entrypoint.s…"   3 minutes ago       Exited (0) 7 seconds ago                         my-site_cache_1
02e42c13b9ff        postgres:9.6                                              "docker-entrypoint.s…"   3 minutes ago       Exited (0) 7 seconds ago                         my-site_db_1

@ppanero ppanero merged commit 2bf6547 into inveniosoftware:master Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce command to stop local containers
3 participants