forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
62 lines (60 loc) · 2.44 KB
/
Rakefile
1
2
3
4
5
6
7
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
CONTAINER_USERID = %x(id -u).freeze
namespace :docker do
desc 'Build our development environment'
task :build do
begin
# Setup the git commit message template
sh 'git config commit.template .gitmessage'
sh 'touch docker-files/home/.bash_history docker-files/home/.irb_history docker-files/home/.pry_history'
sh "cat << EOF > docker-compose.override.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
frontend:
build:
args:
CONTAINER_USERID: #{CONTAINER_USERID}
volumes:
- ./docker-files/home/.bash_history:/home/frontend/.bash_history
- ./docker-files/home/.irb_history:/home/frontend/.irb_history
- ./docker-files/home/.pry_history:/home/frontend/.pry_history
- ./docker-files/home/.irbrc:/home/frontend/.irbrc
- ./docker-files/home/.pryrc:/home/frontend/.pryrc
EOF"
sh "cat << EOF > docker-compose.minitest-user.yml
# This file is generated by our Rakefile. Do not change it!
version: '2.1'
services:
minitest:
build:
args:
CONTAINER_USERID: #{CONTAINER_USERID}
EOF"
# Build the frontend container and pull newer version of the image if available
sh 'docker-compose build --pull frontend'
# Build the minitest container on top of that
sh 'docker-compose -f docker-compose.yml -f docker-compose.minitest.yml -f docker-compose.minitest-user.yml build --pull minitest'
# Bootstrap the app
sh 'docker-compose up -d db'
sh 'docker-compose run --no-deps --rm frontend bundle exec rake dev:bootstrap RAILS_ENV=development'
ensure
sh 'docker-compose stop'
end
end
namespace :sre do
desc 'Prepare the application health monitoring containers'
task :build do
begin
sh 'docker-compose -f docker-compose.sre.yml -f docker-compose.yml up -d rabbit'
sh 'wget http://localhost:15672/cli/rabbitmqadmin -O contrib/rabbitmqadmin'
sh 'chmod +x contrib/rabbitmqadmin'
sh './contrib/rabbitmqadmin declare exchange name=pubsub type=topic durable=true auto_delete=false internal=false'
# configure the app
sh 'docker-compose -f docker-compose.sre.yml -f docker-compose.yml up -d db'
sh 'docker-compose -f docker-compose.sre.yml -f docker-compose.yml run --no-deps --rm frontend bundle exec rake dev:sre:configure'
ensure
sh 'docker-compose -f docker-compose.sre.yml -f docker-compose.yml stop'
end
end
end
end