precog / labcoat-legacy

The legacy version of Labcoat.
GNU Affero General Public License v3.0
3 stars 1 forks source link

Please post HAProxy config for labcoat #1

Closed kenips closed 10 years ago

kenips commented 10 years ago

We'd like to get labcoat running but we have a couple mappings to figure out. Is it possible for you guys to post your HAProxy mapping?

dcsobral commented 10 years ago

I'm not sure what do you mean by labcoat mappings. Labcoat is served by apache, being a javascript application. If you mean the mappings for precog platform, then, below, is a simplified version of what we used in production. I removed extraneous stuff such as fine tuning settings for our servers, redundancy and legacy services, and tried to keep the basic mappings used.

frontend                http
    bind            *:80
    bind            *:443 ssl crt /etc/haproxy/maincert-chain.pem crt /etc/haproxy/certs ciphers HIGH:MEDIUM:!ADH

    acl             ANALYTICS_PATH path_beg /analytics/v1
    acl             META_PATH path_beg /meta/v1
    acl             INGEST_PATH path_beg /ingest/v1
    acl             SECURITY_PATH path_beg /security/v1
    acl             ACCOUNTS_PATH path_beg /accounts/v1
    acl             JOBS_PATH path_beg /jobs/v1

    acl             ANALYTICS_HEALTH path_beg /blueeyes/services/analytics/
    acl             INGEST_HEALTH path_beg /blueeyes/services/ingest/
    acl             SECURITY_HEALTH path_beg /blueeyes/services/security/
    acl             ACCOUNTS_HEALTH path_beg /blueeyes/services/accounts/
    acl             JOBS_HEALTH path_beg /blueeyes/services/jobs/

    acl             HAS_SSL ssl_fc

    # Block external access to accounts -- all blocks apply before any use_backend rule
    block           if ACCOUNTS_PATH !HAS_SSL

    use_backend     service_ingest      if INGEST_PATH or INGEST_HEALTH
    use_backend     service_security    if SECURITY_PATH or SECURITY_HEALTH
    use_backend     service_accounts    if ACCOUNTS_PATH HAS_SSL or ACCOUNTS_HEALTH
    use_backend     service_query       if ANALYTICS_PATH or META_PATH or ACCOUNTS_HEALTH
    use_backend     service_jobs        if JOBS_PATH or JOBS_HEALTH

    # IDE requests go to apache for servicing
    acl             labcoat_req  hdr_dom(host)    -i labcoat
    acl             builder_req  hdr_dom(host)    -i builder
    acl             local_req hdr_dom(host)       -i <%= node[:hostname] %>
    use_backend     localapache       if labcoat_req or local_req or builder_req

    default_backend service_query

backend                 service_ingest
    reqrep          ^([^\ ]*)\ /ingest/v1/(.*) \1\ /ingest/v2/\2
    option          httpchk GET /ingest/v2/health
    server          local_ingest01 localhost:30060 check observe layer7

backend                 service_security
    option          httpchk GET /security/v1/health
    server          local_security01 localhost:30062 check observe layer7

backend                 service_accounts
    option          httpchk GET /accounts/v1/health
    server          local_accounts01 localhost:30064 check observe layer7

backend                 service_jobs
    option          httpchk GET /jobs/v1/health
    server          local_jobs01 localhost:30066 check observe layer7

backend                 service_query
    # Query handles queries and metadata now
    reqrep          ^([^\ ]*)\ /analytics/v1/(.*) \1\ /analytics/v2/analytics/\2
    reqrep          ^([^\ ]*)\ /meta/v1/(.*) \1\ /analytics/v2/meta/\2
    option          httpchk GET /analytics/v2/health
    server          local_shard01 localhost:30070 check observe layer7

backend                 localapache
    server          localapache localhost:20000
kenips commented 10 years ago

yep - that's exactly what I was looking for. Thanks @dcsobral. Will close once I can confirm if this works.

kenips commented 10 years ago

thanks!