-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Change the CLI structure to support docker swarm #126
Comments
we can also use kubernetes as a reference for naming the commands. Based on Kubernetes commands, here's a proposed set of Sugar commands that map to both Docker Swarm and Docker Compose commands. This unified command set aims to provide a consistent interface inspired by Kubernetes, allowing users to manage services across different orchestration platforms seamlessly. Proposed Sugar Commands and Their Mappings
Example Usage
Additional Notes
By aligning Sugar's command set with Kubernetes commands, you provide users with a familiar interface that abstracts the underlying differences between Docker Swarm and Docker Compose. This approach simplifies container orchestration and improves developer productivity. |
In order to support docker swarm, we need to rewrite the CLI commands to something more generic and create a map for docker compose and swarm.
Here's a proposal for a new Sugar CLI API that abstracts common container orchestration commands, mapping them to both Docker Compose and Docker Swarm. This unified API aims to provide a consistent user experience regardless of the underlying orchestration tool.
this should be done before #124
Proposed Sugar Commands and Their Mappings
sugar deploy
docker-compose up -d
docker stack deploy -c [compose-file] [stack-name]
sugar remove
docker-compose down
docker stack rm [stack-name]
sugar build
docker-compose build
sugar start
docker-compose start
docker service scale [service]=[replicas]
sugar stop
docker-compose stop
docker service scale [service]=0
sugar restart
docker-compose restart
docker service update --force [service]
sugar scale [service]=[replicas]
docker-compose up -d --scale [service]=[replicas]
docker service scale [service]=[replicas]
sugar logs [service]
docker-compose logs [service]
docker service logs [service]
sugar exec [service] [command]
docker-compose exec [service] [command]
docker exec
on a container ID.docker exec [container_id] [command]
sugar status
docker-compose ps
docker stack services [stack-name]
sugar ps
docker-compose ps
docker service ps [service]
sugar update
docker-compose up -d
(after changing the compose file)docker service update [options] [service]
sugar config
docker-compose config
sugar inspect [service]
docker-compose exec [service] inspect
docker service inspect [service]
sugar pause
/sugar unpause
docker-compose pause
/docker-compose unpause
sugar secret
docker secret
commands.docker secret create
,docker secret ls
, etc.sugar network
docker network
commands.docker network create
,docker network ls
, etc.Additional Considerations
Configuration File Detection: Sugar can detect whether to use Docker Compose or Docker Swarm based on a configuration flag or the presence of Swarm-specific settings.
Context Flag: Introduce a global
--context
flag to specify the orchestration tool (e.g.,--context compose
or--context swarm
).Error Handling: Provide informative errors when a command isn't supported in the current context.
Extended Commands: For Swarm-specific features like rolling updates, health checks, and secret management, extend Sugar with additional commands as needed.
Aliases and Shortcuts: Allow for command aliases to make the CLI more intuitive.
Example Usage
Deploy Services
Scale a Service
View Logs
Execute Command in a Service
sugar exec web bash
Update a Service
Stop Services
By defining these commands, Sugar provides a unified interface that abstracts away the differences between Docker Compose and Docker Swarm. This allows users to manage their containerized applications seamlessly, regardless of the underlying orchestration platform.
The text was updated successfully, but these errors were encountered: