Class: SmartCloud::Grids::Redmine

Inherits:
Base
  • Object
show all
Defined in:
lib/smart_cloud/grids/redmine.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

configure_logger_for, included, #logger, logger_for

Constructor Details

#initializeRedmine

Returns a new instance of Redmine.



5
6
# File 'lib/smart_cloud/grids/redmine.rb', line 5

def initialize
end

Class Method Details

.downObject



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/smart_cloud/grids/redmine.rb', line 42

def self.down
	if SmartCloud::Docker.running?
		# Stopping & Removing containers - in reverse order
		print "-----> Stopping container redmine ... "
		if system("docker stop 'redmine'", out: File::NULL)
			puts "done"
			print "-----> Removing container redmine ... "
			if system("docker rm 'redmine'", out: File::NULL)
				puts "done"
			end
		end
	end
end

.upObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/smart_cloud/grids/redmine.rb', line 8

def self.up
	if SmartCloud::Docker.running?
		# Creating & Starting containers
		print "-----> Creating container redmine ... "
		if system("docker create \
			--name='redmine' \
			--env VIRTUAL_HOST=redmine.#{SmartCloud.config.apps_domain} \
			--env LETSENCRYPT_HOST=redmine.#{SmartCloud.config.apps_domain} \
			--env LETSENCRYPT_EMAIL=#{SmartCloud.config.sysadmin_email} \
			--env LETSENCRYPT_TEST=false \
			--env REDMINE_SECRET_KEY_BASE=#{SmartCloud.credentials.redmine[:secret_key_base]} \
			--env REDMINE_DB_MYSQL=#{SmartCloud.credentials.redmine[:database_host]} \
			--env REDMINE_DB_PORT=#{SmartCloud.credentials.redmine[:database_port]} \
			--env REDMINE_DB_USERNAME=#{SmartCloud.credentials.redmine[:database_username]} \
			--env REDMINE_DB_PASSWORD=#{SmartCloud.credentials.redmine[:database_password]} \
			--env REDMINE_DB_DATABASE=#{SmartCloud.credentials.redmine[:database_name]} \
			--env REDMINE_PLUGINS_MIGRATE=#{SmartCloud.credentials.redmine[:plugins_migrate]} \
			--volume='#{SmartCloud.config.user_home_path}/.smartcloud/apps/repositories:/repositories:ro' \
			--volume='#{SmartCloud.config.user_home_path}/.smartcloud/grids/redmine/files:/usr/src/redmine/files' \
			--restart='always' \
			--network='nginx-network' \
			redmine:4.0.5-alpine", out: File::NULL)

			system("docker network connect mysql-network redmine")

			puts "done"
			print "-----> Starting container redmine ... "
			if system("docker start redmine", out: File::NULL)
				puts "done"
			end
		end
	end
end