From 35d4ad4f563850657a0948fbd3c44688fde9cbbd Mon Sep 17 00:00:00 2001 From: Mike Richardson Date: Sun, 13 Oct 2019 13:42:40 +1100 Subject: [PATCH] set Tokaido to use pinned image tags, rather than 'edge' or 'stable' --- cmd/rebuild.go | 2 +- cmd/root.go | 1 - cmd/up.go | 2 +- constants/images.go | 7 ++++-- initialize/main.go | 2 +- services/docker/generate.go | 2 +- services/docker/templates/compose.go | 36 ++++++++++++++++------------ services/proxy/struct.go | 5 ++-- services/tok/init.go | 9 +------ services/tok/new.go | 2 +- 10 files changed, 35 insertions(+), 33 deletions(-) diff --git a/cmd/rebuild.go b/cmd/rebuild.go index 5e04961e..28e9d13c 100644 --- a/cmd/rebuild.go +++ b/cmd/rebuild.go @@ -24,7 +24,7 @@ var RebuildCmd = &cobra.Command{ docker.Stop() unison.UnloadSyncService(conf.GetConfig().Tokaido.Project.Name) - tok.Init(true, false, false) + tok.Init(true, false) tok.InitMessage() diff --git a/cmd/root.go b/cmd/root.go index f506ebfa..0d95628e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -70,7 +70,6 @@ func RootCmd() *cobra.Command { rootCmd.PersistentFlags().BoolP("debug", "d", false, "Enable debug mode, command output is printed to the console") OpenCmd.PersistentFlags().BoolVarP(&adminFlag, "admin", "", false, "Create a one-time admin login URL and open") - UpCmd.PersistentFlags().BoolVarP(&noPullImagesFlag, "no-pull-images", "", false, "Stop Tokaido from downloaded the latest Docker images") TestCmd.PersistentFlags().BoolVarP(&useExistingDBFlag, "use-existing-db", "", false, "Run the test suite without recreating the database or temporary users. Note: this may cause test flakiness due to database having prior state.") SnapshotNewCmd.PersistentFlags().StringVarP(&nameFlag, "name", "n", "", "Specify a name to be added to the snapshot name. If not specified, Tokaido will only use the current UTC date and time") diff --git a/cmd/up.go b/cmd/up.go index 65c07926..4ab355ec 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -21,7 +21,7 @@ var UpCmd = &cobra.Command{ telemetry.SendCommand("up") utils.CheckCmdHard("docker-compose") - tok.Init(conf.GetConfig().Tokaido.Yes, true, noPullImagesFlag) + tok.Init(conf.GetConfig().Tokaido.Yes, true) tok.InitMessage() }, } diff --git a/constants/images.go b/constants/images.go index d315ff18..9ec3acf0 100644 --- a/constants/images.go +++ b/constants/images.go @@ -1,6 +1,9 @@ package constants const ( - // ProxyStableVersion ... - ProxyStableVersion string = "1.11.0" + // StableVersion is the tag for all Tokaido images that are running in Ironstar Production environments at the time of this Tokaido release + StableVersion string = "stable" + + // EdgeVersion is the tag for all Tokaido images that are running in Ironstar Non-Production environments at the time of this Tokaido release + EdgeVersion string = "1.11.0" ) diff --git a/initialize/main.go b/initialize/main.go index 6e9947a0..27542bc3 100644 --- a/initialize/main.go +++ b/initialize/main.go @@ -72,7 +72,7 @@ func readProjectConfig(command string) { viper.SetDefault("Tokaido.Debug", viper.GetBool("debug")) viper.SetDefault("Tokaido.Force", viper.GetBool("force")) viper.SetDefault("Tokaido.Yes", viper.GetBool("yes")) - viper.SetDefault("Tokaido.Stability", "edge") + viper.SetDefault("Tokaido.Stability", constants.EdgeVersion) viper.SetDefault("Tokaido.Dependencychecks", true) viper.SetDefault("Tokaido.Enableemoji", emojiDefaults()) viper.SetDefault("Tokaido.Phpversion", "7.2") diff --git a/services/docker/generate.go b/services/docker/generate.go index bf28a705..061df7c6 100644 --- a/services/docker/generate.go +++ b/services/docker/generate.go @@ -260,7 +260,7 @@ func UnmarshalledDefaults() conf.ComposeDotTok { } // Set our stability version - err = yaml.Unmarshal(dockertmpl.StabilityLevel(phpVersion, conf.GetConfig().Tokaido.Stability), &tokStruct) + err = yaml.Unmarshal(dockertmpl.ImageVersion(phpVersion, conf.GetConfig().Tokaido.Stability), &tokStruct) if err != nil { log.Fatalf("Error updating stability version for containers in Compose file: %v", err) } diff --git a/services/docker/templates/compose.go b/services/docker/templates/compose.go index a9543442..d32f1ef2 100644 --- a/services/docker/templates/compose.go +++ b/services/docker/templates/compose.go @@ -4,6 +4,7 @@ import ( "log" "github.com/ironstar-io/tokaido/conf" + "github.com/ironstar-io/tokaido/constants" "github.com/ironstar-io/tokaido/system/fs" homedir "github.com/mitchellh/go-homedir" ) @@ -56,41 +57,46 @@ func DrupalSettings(drupalRoot string, projectName string) []byte { PROJECT_NAME: ` + projectName) } -// StabilityLevel ... -func StabilityLevel(phpVersion, stability string) []byte { +// ImageVersion ... +func ImageVersion(phpVersion, stability string) []byte { v := calcPhpVersionString(phpVersion) + imageVersion := constants.EdgeVersion + if stability == "stable" { + imageVersion = constants.StableVersion + } + if conf.GetConfig().Global.Syncservice == "fusion" { return []byte(`services: sync: - image: tokaido/sync:` + stability + ` + image: tokaido/sync:` + imageVersion + ` syslog: - image: tokaido/syslog:` + stability + ` + image: tokaido/syslog:` + imageVersion + ` haproxy: - image: tokaido/haproxy:` + stability + ` + image: tokaido/haproxy:` + imageVersion + ` varnish: - image: tokaido/varnish:` + stability + ` + image: tokaido/varnish:` + imageVersion + ` nginx: - image: tokaido/nginx:` + stability + ` + image: tokaido/nginx:` + imageVersion + ` fpm: - image: tokaido/php` + v + `-fpm:` + stability + ` + image: tokaido/php` + v + `-fpm:` + imageVersion + ` drush: - image: tokaido/admin` + v + `-heavy:` + stability + ``) + image: tokaido/admin` + v + `-heavy:` + imageVersion + ``) } return []byte(`services: syslog: - image: tokaido/syslog:` + stability + ` + image: tokaido/syslog:` + imageVersion + ` haproxy: - image: tokaido/haproxy:` + stability + ` + image: tokaido/haproxy:` + imageVersion + ` varnish: - image: tokaido/varnish:` + stability + ` + image: tokaido/varnish:` + imageVersion + ` nginx: - image: tokaido/nginx:` + stability + ` + image: tokaido/nginx:` + imageVersion + ` fpm: - image: tokaido/php` + v + `-fpm:` + stability + ` + image: tokaido/php` + v + `-fpm:` + imageVersion + ` drush: - image: tokaido/admin` + v + `-heavy:` + stability + ``) + image: tokaido/admin` + v + `-heavy:` + imageVersion + ``) } // EnableSolr ... diff --git a/services/proxy/struct.go b/services/proxy/struct.go index 5076fc8d..49946f77 100644 --- a/services/proxy/struct.go +++ b/services/proxy/struct.go @@ -1,6 +1,7 @@ package proxy import ( + "github.com/ironstar-io/tokaido/conf" "github.com/ironstar-io/tokaido/constants" ) @@ -42,7 +43,7 @@ func ComposeDefaults() []byte { return []byte(`version: "2" services: proxy: - image: tokaido/proxy:` + constants.ProxyStableVersion + ` + image: tokaido/proxy:` + conf.GetConfig().Tokaido.Stability + ` ports: - "` + constants.ProxyPort + `:` + constants.ProxyPort + `" volumes: @@ -72,7 +73,7 @@ services: - default - tokaido_proxy proxy: - image: tokaido/proxy:` + constants.ProxyStableVersion + ` + image: tokaido/proxy:` + conf.GetConfig().Tokaido.Stability + ` ports: - "` + constants.ProxyPort + `:` + constants.ProxyPort + `" volumes_from: diff --git a/services/tok/init.go b/services/tok/init.go index d7aa6946..8bafea9b 100644 --- a/services/tok/init.go +++ b/services/tok/init.go @@ -30,7 +30,7 @@ import ( ) // Init - The core run sheet of `tok up` -func Init(yes, statuscheck, noPullImagesFlag bool) { +func Init(yes, statuscheck bool) { c := conf.GetConfig() cs := "ASK" if yes { @@ -97,13 +97,6 @@ func Init(yes, statuscheck, noPullImagesFlag bool) { console.SpinPersist(wo, "🚛", "Initial sync completed") } - if noPullImagesFlag { - fmt.Println(" Not downloading the latest Docker images") - } else { - fmt.Println("🤖 Downloading the latest Docker images") - docker.PullImages() - } - // Configure TLS fmt.Println("🔐 Configuring TLS Certificates") tls.ConfigureTLS() diff --git a/services/tok/new.go b/services/tok/new.go index 65a51a01..87046f36 100644 --- a/services/tok/new.go +++ b/services/tok/new.go @@ -208,7 +208,7 @@ func New(args []string, requestTemplate string) { // Start the environment initialize.TokConfig("up") - Init(true, false, false) + Init(true, false) // Run the post-up custom installation commands l := len(template.PostUpCommands)