diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2ad7315..abb935d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,7 @@ jobs: uses: goreleaser/goreleaser-action@v3 with: distribution: goreleaser - version: latest + version: "~> v1" args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG b/CHANGELOG index 6b7d2e7..7fdb135 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## UNRELEASED +[0.11.0] - 2024-06-12 + +- Add stop command for docker-compose +- Remove the obsolete version tag from the docker-compose file + [0.10.1] - 2024-05-06 +- Fix error on startup + +[0.10.0] - 2024-05-02 + - Fix for new MySQL 8 images. [0.9.0] - 2024-03-15 @@ -19,6 +28,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump version of Redis Insight to V2 and change the exported port to 5540. +[0.7.6] - 2024-03-04 + +- Bump version to 0.7.6 +- Move to insights v2 (#10) + [0.7.5] - 2024-01-18 - Restore Lenses Box image for Kafka as it now works on arm64. diff --git a/README.md b/README.md index 4df64a9..80f166d 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,10 @@ Or you can build it from source by running the following from the root directory `global_docker_compose` has multiple sub-commands, most of which should be familiar: * `global_docker_compose up --service=,`: Bring up a list of services as defined by the table below. -* `global_docker_compose down {service}`: Bring down the specificed service, or all services if not provided. +* `global_docker_compose down {service}`: Bring down the specified service, or all services if not provided. * `global_docker_compose down`: Bring down all services. +* `global_docker_compose stop --service=,`: Stop the specified services, or all services if not provided. +* `global_docker_compose stop`: Stop all services. * `global_docker_compose ps`: Show all running services that were configured using the tool. * `global_docker_compose config`: Print out the docker compose config file being used. * `global_docker_compose logs {service}`: Print out logs for the specified service, or all services if not provided. diff --git a/cmd/gdc/commands/root.go b/cmd/gdc/commands/root.go index f3c45e4..93fe9ad 100644 --- a/cmd/gdc/commands/root.go +++ b/cmd/gdc/commands/root.go @@ -19,10 +19,10 @@ var ComposeFile string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Version: "0.10.0", - Use: "global_docker_compose (command) --services service1 service2 --compose_file ../docker-compose.yml", - Short: "Generate JSON files to use with the Flipp platform deploy scripts", - Long: ` + Version: "0.11.0", + Use: "global_docker_compose (command) --services service1 service2 --compose_file ../docker-compose.yml", + Short: "Generate JSON files to use with the Flipp platform deploy scripts", + Long: ` global_docker_compose can be used to centralize and standardize Docker dependencies used within Flipp. The idea is to have one tool that can spin up whatever services are needed and keep that tool updated with fixes and improvements, rather than having a separate docker-compose.yml file in every project. diff --git a/cmd/gdc/commands/stop.go b/cmd/gdc/commands/stop.go new file mode 100644 index 0000000..cc0bec0 --- /dev/null +++ b/cmd/gdc/commands/stop.go @@ -0,0 +1,43 @@ +/* +Package commands Copyright © 2021 NAME HERE + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package commands + +import ( + "github.com/spf13/cobra" + "github.com/wishabi/global-docker-compose/gdc" +) + +// StopCmd represents the stop command +var StopCmd = &cobra.Command{ + Use: "stop", + Short: "Stop Docker containers", + Long: ` + Stop either specified or all Docker containers. + + Usage: global_docker_compose stop {service} + global_docker_compose stop + `, + Args: cobra.MaximumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + info := gdc.NewComposeInfo(ComposeFile, Services) + gdc.Stop(info) + gdc.Cleanup() + }, +} + +func init() { + rootCmd.AddCommand(StopCmd) +} diff --git a/gdc/docker-compose.yml b/gdc/docker-compose.yml index 9909363..63243f3 100644 --- a/gdc/docker-compose.yml +++ b/gdc/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.6' services: # ---------- DATABASES ---------- diff --git a/gdc/docker.go b/gdc/docker.go index ddb39bb..ef886a4 100644 --- a/gdc/docker.go +++ b/gdc/docker.go @@ -138,7 +138,7 @@ func Up(compose ComposeInfo) { // Down bring down the Docker containers func Down(compose ComposeInfo, service string) { if len(compose.RequestedServices) > 0 { - fmt.Printf("Requsted services ,%v", compose.RequestedServices[0]) + fmt.Printf("Requested services ,%v", compose.RequestedServices[0]) var command string if service != "" { command = service @@ -152,6 +152,16 @@ func Down(compose ComposeInfo, service string) { } } +// Stop the Docker containers +func Stop(compose ComposeInfo) { + if len(compose.RequestedServices) > 0 { + fmt.Printf("Requested services ,%v", compose.RequestedServices[0]) + RunCommand("%s stop %s", mainCommand(compose), serviceString(compose, "stop")) + } else { + RunCommand("%s stop", mainCommand(compose)) + } +} + // Logs show the logs for the selected containers func Logs(compose ComposeInfo, service string) { var command string diff --git a/global_docker_compose b/global_docker_compose index be904f0..7eb61dc 100755 Binary files a/global_docker_compose and b/global_docker_compose differ