-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] Add docker-compose file for HAProxy setup
as testing ground for a production HA setup. * Loadbalancing by HAProxy is now available via localhost:8080 * First frontend node can be accessed via localhost:3000 * Second frontend node can be accessed via localhost:3001
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "2.1" | ||
services: | ||
proxy: | ||
image: haproxy:1.7 | ||
volumes: | ||
- ./contrib/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro | ||
ports: | ||
- "8080:80" | ||
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 |