Sha256: cb0f4af6f1dad3ffaabef31b68fc80dfd18ba3042a71a2d7bce11597190be8e3
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
require "sct_core" require_relative "docker" module Shell class Php < Docker attr_accessor :make # Configure the Yarn command def self.config self.set_image("eu.gcr.io/dev-pasc-vcdm/proactive-base:latest", true) self.set_pwd_as_volume("/var/www") self.set_current_user_and_group self.set_entrypoint("php") self.set_environment_variables(self.get_environment_variables) end def self.get_environment_variables environment_variables = {} environment_variables.store("ENVIRONMENT", "local") environment_variables = self.add_service_ip_and_port(environment_variables) return environment_variables end def self.add_service_ip_and_port(environment_variables) service_names = %w[mysql-service redis-service] minikube_status service_names.each { |service_name| url = `#{SctCore::Helper.minikube} service #{service_name} --url` ip_and_port = url.match /(?<ip>[0-9]+(?:\.[0-9]+){3}):(?<port>[0-9]+)/ case service_name when "mysql-service" environment_variables.store("DB_HOST", ip_and_port[:ip]) environment_variables.store("DB_PORT", ip_and_port[:port]) when "redis-service" environment_variables.store("REDIS_HOST", ip_and_port[:ip]) environment_variables.store("REDIS_PORT", ip_and_port[:port]) end } return environment_variables end def self.minikube_status output = `#{SctCore::Helper.minikube} status` if output.scan(/Running/).length != 3 && output.scan(/Configured/).length != 1 UI.important("Please check your minikube status. If all services are stopped you should start the minikube first.") exit end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sct-0.1.28 | shell/lib/shell/docker/php.rb |
sct-0.1.27 | shell/lib/shell/docker/php.rb |
sct-0.1.26 | shell/lib/shell/docker/php.rb |