{"id":28920432,"url":"https://github.com/praqma/ci-with-haproxy","last_synced_at":"2025-07-25T15:07:15.696Z","repository":{"id":141086033,"uuid":"81091854","full_name":"Praqma/CI-with-HAProxy","owner":"Praqma","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-02T08:15:58.000Z","size":385,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-22T04:13:39.340Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Praqma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-06T13:51:03.000Z","updated_at":"2018-08-02T08:15:59.000Z","dependencies_parsed_at":"2023-03-17T15:00:18.433Z","dependency_job_id":null,"html_url":"https://github.com/Praqma/CI-with-HAProxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Praqma/CI-with-HAProxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2FCI-with-HAProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2FCI-with-HAProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2FCI-with-HAProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2FCI-with-HAProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Praqma","download_url":"https://codeload.github.com/Praqma/CI-with-HAProxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2FCI-with-HAProxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267023048,"owners_count":24022911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-22T04:13:36.904Z","updated_at":"2025-07-25T15:07:15.680Z","avatar_url":"https://github.com/Praqma.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nmaintainer: KamranAzeem\n---\n\n# CI (Continuous Integration) with HA-Proxy\n\n# The itch:\nWhen I setup Jenkins and Artifactory setup, why do I (always) have to use Apache, or Nginx as reverse proxy? :( Can there be something simpler? Can I use haproxy? Will it work? \n\n# The answer:\nYes. \n\n# Details\nYes, we can use haproxy as a reverse proxy for our docker application stack! It has a much simpler and cleaner configuration. No more cryptic apache or nginx configurations! Hurray!\n\n\n## Setup:\n\nThe accompanying docker-compose.yml file brings up a very simple application suite consisting of Jenkins, Artifactory and HAProxy. It expects persistent storage, and it uses SSL for haproxy. That means haproxy is also the SSL terminator. The persistent storage and SSL are taken care of in the  `setup.sh` script. \n\nIn this example setup HAProxy uses the host headers to differentiate between different types of requests, and it uses `example.com` for that. So we have `jenkins.example.com` and `artifactory.example.com` setup in haproxy. If you want to access this application suite by some other means , then you change those names in haproxy.cfg .\n \nThen you need some way of pointing `jenkins.example.com`  and `artifactory.example.com` towards the machine where you are running this stack. If it is localhost (normally Linux PCs) then you can modify `/etc/hosts`. If it is somewhere else on some other virtual or physical machine, anywhere in the world (including VMs on your machines), you can either use `/etc/hosts` again, or have some other DNS mechanism in place.\n\n## Preparation:\n* Clone this repo to your computer. \n* Have docker and docker-compose installed on that computer.\n* Run the `setup.sh`script . It creates necessary directory structure, creates SSL certs, and copies haproxy.cfg to persistent storage. (Though we can actually make it part of haproxy image). \n\n\n```\n[kamran@dockerhost ci-with-haproxy]$ ./setup.sh \nThis script will run as sudo ...\n\nCreating directory structure under /opt/ci-with-haproxy\n\n/opt/ci-with-haproxy\n├── artifactory\n│   ├── backup\n│   ├── data\n│   └── logs\n├── haproxy\n└── jenkins\n    └── jenkins_home\n\n7 directories\n\nCreating self signed certificates in /tmp - in non-interactive mode ...\n\nGenerating RSA private key, 2048 bit long modulus\n..............+++\n........+++\ne is 65537 (0x10001)\nwriting RSA key\nSignature ok\nsubject=/C=NO/ST=Oslo/L=Oslo/O=Praqma/OU=IT/CN=*.example.com\nGetting Private key\n\nCreating a combined certificate and saving it as /opt/ci-with-haproxy/haproxy/haproxy.pem\n\nCopy haproxy.cfg to /opt/ci-with-haproxy/haproxy/\n\nDone.\n\nYou can start the application suite using docker-compose up -d\n\n[kamran@dockerhost ci-with-haproxy]$\n```\n\n\n**Note:** You can run setup.sh multiple times, even if artifactory and jenkins are already running and have already created their home directories and all that. The script simply tries to create the directories and chmod 1000:1000 on them. If the directories are already there, it simply fails (silently for those commands. \n\n\n## Run the application:\nWhen ready, bring up the application suite using `docker-compose up -d`\n\n\n```\n[kamran@dockerhost ci-with-haproxy]$ docker-compose up -d\nCreating network \"ciwithhaproxy_default\" with the default driver\nPulling haproxy (haproxy:1.7)...\nTrying to pull repository docker.io/library/haproxy ... \nsha256:32be2bd1ec0e8cea7a990e18bd0069b09f23781e9004b20cd7e473b23e146f23: Pulling from docker.io/library/haproxy\n5040bd298390: Already exists\n63408554ba61: Already exists\n3ea5adf19ff4: Pull complete\nDigest: sha256:32be2bd1ec0e8cea7a990e18bd0069b09f23781e9004b20cd7e473b23e146f23\nStatus: Downloaded newer image for docker.io/haproxy:1.7\nPulling artifactory (mattgruter/artifactory:latest)...\nTrying to pull repository docker.io/mattgruter/artifactory ... \nsha256:85e3748026700065aafab4753f0214ccd43e99951c57dda2a33d4ed0ad57265a: Pulling from docker.io/mattgruter/artifactory\n5040bd298390: Already exists\nfce5728aad85: Pull complete\nc42794440453: Pull complete\n9e53c91deee9: Pull complete\n4eb6a09786b9: Pull complete\nDigest: sha256:85e3748026700065aafab4753f0214ccd43e99951c57dda2a33d4ed0ad57265a\nStatus: Downloaded newer image for docker.io/mattgruter/artifactory:latest\nCreating ciwithhaproxy_haproxy_1\nCreating ciwithhaproxy_artifactory_1\nCreating ciwithhaproxy_jenkins_1\n[kamran@dockerhost ci-with-haproxy]$\n```\n\n## Check status:\n\n```\n[kamran@dockerhost ci-with-haproxy]$ docker-compose ps\n           Name                          Command               State                    Ports                   \n---------------------------------------------------------------------------------------------------------------\nciwithhaproxy_artifactory_1   catalina.sh run                  Up      8080/tcp                                 \nciwithhaproxy_haproxy_1       /docker-entrypoint.sh hapr ...   Up      0.0.0.0:443-\u003e443/tcp, 0.0.0.0:80-\u003e80/tcp \nciwithhaproxy_jenkins_1       /bin/tini -- /usr/local/bi ...   Up      0.0.0.0:50000-\u003e50000/tcp, 8080/tcp       \n[kamran@dockerhost ci-with-haproxy]$ \n```\n\n```\n[kamran@dockerhost ci-with-haproxy]$ docker ps\nCONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                      NAMES\n10ee02b39703        ciwithhaproxy_jenkins    \"/bin/tini -- /usr/lo\"   About an hour ago   Up About an hour    8080/tcp, 0.0.0.0:50000-\u003e50000/tcp         ciwithhaproxy_jenkins_1\n968f0cc62506        mattgruter/artifactory   \"catalina.sh run\"        About an hour ago   Up About an hour    8080/tcp                                   ciwithhaproxy_artifactory_1\n2f0bf010ca87        haproxy:1.7              \"/docker-entrypoint.s\"   About an hour ago   Up About an hour    0.0.0.0:80-\u003e80/tcp, 0.0.0.0:443-\u003e443/tcp   ciwithhaproxy_haproxy_1\n[kamran@dockerhost ci-with-haproxy]$ \n```\n\n\n## Access from browser:\n\n![jenkins.png](jenkins.png)\n\n![artifactory.png](artifactory.png)\n\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraqma%2Fci-with-haproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraqma%2Fci-with-haproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraqma%2Fci-with-haproxy/lists"}