Skip to content

Commit

Permalink
Merge pull request #4912 from ChrisBr/deployment/ha-proxy
Browse files Browse the repository at this point in the history
[frontend] Add docker-compose file for HAProxy
  • Loading branch information
ChrisBr committed Jun 8, 2018
2 parents 28c67d5 + 678cc1d commit 2740966
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 16 deletions.
5 changes: 5 additions & 0 deletions contrib/Procfile.ha
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
web: bundle exec rails server -P tmp/pids/server$NODE_NUMBER.pid
delayed: bundle exec script/delayed_job.api.rb run
clock: bundle exec clockworkd --log-dir=log -l -c config/clock.rb run
search: bundle exec rake ts:rebuild NODETACH=true
mailcatcher: mailcatcher --ip 0.0.0.0 -f --no-quit -v
33 changes: 33 additions & 0 deletions contrib/haproxy.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000

resolvers dockerdns
nameserver dns 127.0.0.11:53

frontend localnodes
bind *:80
mode http
default_backend nodes

backend nodes
mode http
balance roundrobin
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
option httpchk HEAD /about HTTP/1.1\r\nHost:localhost
server web01 frontend:3000 check resolvers dockerdns resolve-prefer ipv4
server web02 frontend_node_2:3000 check resolvers dockerdns resolve-prefer ipv4

listen stats
bind :32700
stats enable
stats uri /
stats hide-version
stats auth Admin:opensuse
24 changes: 24 additions & 0 deletions contrib/thinking_sphinx.yml.ha
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
development:
mysql41: 9312
bin_path: /usr/bin
mem_limit: 512M
charset_table: "0..9, a..z, A..Z->a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
mysql41: <%= 9313 + ENV['NODE_NUMBER'].to_i %>
indices_location: <%= File.join(Rails.root, "db", "sphinx", "development#{ENV['NODE_NUMBER']}") %>
configuration_file: <%= File.join(Rails.root, "config", "development#{ENV['NODE_NUMBER']}.sphinx.conf")%>
log: <%= File.join(Rails.root, "log", "development#{ENV['NODE_NUMBER']}.searchd.log") %>
query_log: <%= File.join(Rails.root, "log", "development#{ENV['NODE_NUMBER']}.searchd.query.log") %>
binlog_path: <%= File.join(Rails.root, "tmp", "binlog", "development#{ENV['NODE_NUMBER']}") %>
pid_file: <%= File.join(Rails.root, "tmp", "pids", "development#{ENV['NODE_NUMBER']}.sphinx.pid") %>
test:
mysql41: 9313
bin_path: /usr/bin
mem_limit: 512M
charset_table: "0..9, a..z, A..Z->a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
# To efficiently deal with large ids generated by fixtures
sql_range_step: 10000000
production:
mysql41: 9314
bin_path: /usr/bin
mem_limit: 512M
charset_table: "0..9, a..z, A..Z->a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
28 changes: 28 additions & 0 deletions docker-compose.ha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "2.1"
services:
proxy:
image: haproxy:1.7
volumes:
- ./contrib/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
ports:
- "8080:80"
- "32700:32700"
depends_on:
- frontend
- frontend_node_2
frontend_node_2:
image: openbuildservice/frontend
environment:
- NODE_NUMBER=2
volumes:
- .:/obs
- ./contrib/thinking_sphinx.yml.ha:/obs/src/api/config/thinking_sphinx.yml:ro
- ./contrib/Procfile.ha:/obs/src/api/Procfile
ports:
- "3001:3000"
- "1081:1080"
depends_on:
- db
- cache
- backend
- worker
2 changes: 1 addition & 1 deletion docker-files/base/Dockerfile.42.3
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN echo 'solver.allowVendorChange = true' >> /etc/zypp/zypp.conf; \
# Install requirements for all our containers
RUN zypper -n install --no-recommends --replacefiles \
make gcc gcc-c++ patch curl vim vim-data psmisc \
timezone ack glibc-locale sudo aaa_base
timezone ack glibc-locale sudo aaa_base hostname

# Add our bootstrap script
ADD docker-bootstrap.sh /root/bin/docker-bootstrap.sh
Expand Down
1 change: 1 addition & 0 deletions src/api/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ gem 'feature'
# for profiling
gem 'peek'
gem 'peek-dalli'
gem 'peek-host'
gem 'peek-mysql2'
# for kerberos authentication
gem 'gssapi', require: false
Expand Down
3 changes: 3 additions & 0 deletions src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ GEM
concurrent-ruby-ext
dalli
peek
peek-host (1.0.0)
peek
peek-mysql2 (1.2.0)
concurrent-ruby
concurrent-ruby-ext
Expand Down Expand Up @@ -462,6 +464,7 @@ DEPENDENCIES
nokogiri
peek
peek-dalli
peek-host
peek-mysql2
poltergeist
pry (>= 0.9.12)
Expand Down
1 change: 1 addition & 0 deletions src/api/config/initializers/peek.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Peek.into Peek::Views::Mysql2
Peek.into Peek::Views::Dalli
Peek.into Peek::Views::Host
15 changes: 0 additions & 15 deletions src/api/docker-files/Dockerfile.old-test-suite

This file was deleted.

0 comments on commit 2740966

Please sign in to comment.