{"id":20282095,"url":"https://github.com/pagerinc/composer","last_synced_at":"2025-05-07T18:31:02.227Z","repository":{"id":33577524,"uuid":"48187436","full_name":"pagerinc/composer","owner":"pagerinc","description":"A docker-compose for your local env","archived":true,"fork":false,"pushed_at":"2023-10-15T04:57:47.000Z","size":96,"stargazers_count":0,"open_issues_count":8,"forks_count":15,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-18T17:53:34.099Z","etag":null,"topics":["docker","docker-compose","infrastructure-as-code","ops"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pagerinc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-12-17T17:05:50.000Z","updated_at":"2024-10-24T16:13:56.000Z","dependencies_parsed_at":"2022-09-07T05:00:17.106Z","dependency_job_id":null,"html_url":"https://github.com/pagerinc/composer","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagerinc%2Fcomposer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagerinc%2Fcomposer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagerinc%2Fcomposer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pagerinc%2Fcomposer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pagerinc","download_url":"https://codeload.github.com/pagerinc/composer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252933966,"owners_count":21827612,"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","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":["docker","docker-compose","infrastructure-as-code","ops"],"created_at":"2024-11-14T14:08:06.073Z","updated_at":"2025-05-07T18:31:01.878Z","avatar_url":"https://github.com/pagerinc.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# composer\nIt's dangerous to go alone! Here's a reliable `docker-compose` to help you on your Backend adventures.\n\n![zelda-nyan](http://i1.kym-cdn.com/photos/images/original/000/402/521/a01.png \"something something\")\n\n## Setup\n\nComposer leverages Docker with sugar, spice and everything that's nice.\n\nClone and install **[Pager's dotfiles][dotfiles]** (recommended) or [Docker for Mac][docker-mac].\n\n\u003e **NOTE**: if you're not using the `dotfiles` repo, you might want to install\n\u003e the following for shell completion.\n\n```bash\nbrew install docker-completion\n```\n\n## Running docker-compose\n\nOnce docker is up and running on your machine, you can start your dev environment by telling the composer to run the [`docker-compose.yml` file][compose-file]. Grab a cup of coffee and run the following:\n\n```\ndocker-compose up\n```\n\nThis will build new images for the RabbitMQ, MongoDB and Redis services and then each process in new containers. Keep in mind, the first time this is run could take a while however, subsequent builds run much quicker since Docker caches the results.\n\nAnd that's it. Congratulations on getting your local env ready for some developing.\n\nPlease note that when you run a service locally, RABBIT_URL should be \"amqp://localhost:5672/db\".\n\n### Running daemonized\n\nIf you don't want to block your io and you're not a big fan of Tmux, you can easily run a daemonized version of docker-compose via the `-d` flag:\n\n```\ndocker-compose up -d\n\n./run_tests\ndocker-compose stop\ndocker-compose rm -f\n```\n\n### Sharing the network\n\nThe `docker-compose.yml` file creates a network called `cloudbuild` to mimic how cloudbuild works locally.\nAll other services should have the following at the bottom of their `docker-compose.yml` files to hook\ninto this shared docker network:\n```yaml\nnetworks:\n  default:\n    external:\n      name: cloudbuild\n```\n\n### Destructive actions\n\n`docker-compose stop` by default is not a destructive action. It leaves the containers and their volumes\nintact, but stop the container. This means that the only resource being used is disk space. If you execute\n`docker-compose down` all coantiners and volumes will be destroyed and need to be rebuilt, which means\nyour databases will revert to empty as well. `docker-compose rm` after a `stop` is the same as running `down`.\n\n## Kong\n\nKong starts when you run `docker-compose up -d` with the rest of the services, and will bind to\nport `80` and `443` on localhost for the proxy listener, and the admin listener will bind to port `8001`.\n\nThere is also a Kong admin UI (Konga) included that binds to `localhost:8002`. You will need to add a connection\nthe first time you start it, and use the address of kong admin _internal_ to the docker network, meaning\nyou will need to use `http://kong:8001` as the kong admin address in Konga.\n\nIn order to generate a configuration for Kong, you will need to have the `pagerinc/charts` repo set up\nlocally. Once you have `charts` set up locally, you can go to that repo and run\n`bash scripts/kong_template.sh -l true -o kong.yaml` which will generate a `decK` config file with all of the\nports and urls set to their localhost values. You should then be able to run `deck sync` (if you have installed `decK`)\nto sync the generated config to your local Kong instance.\n\n### Installing `decK`\n\nInstalling `decK` to automate syncing of Kong configs is very easy using Homebrew. Just run the following\ntwo lines in your shell and you will be good to go.\n\n```bash\nbrew tap hbagdi/deck\nbrew install deck\n```\n\n## Dnsmasq Setup\n\nWe are using `dnsmasq` to run a local DNS server in order to answer the `pager.localhost` DNS requests. To\ninstall dnsmasq, run `bash setup-dnsmasq.sh` which will install and configure dnsmasq and the routing you need.\n\nAfter running the setup, you should be able to run `scutil --dns` and see a resolver for `localhost` listed. If\nyou do not see a resolver for localhost listed, run `sudo vim /etc/resolver/localhost` and then just exit the\nfile without making any changes. MacOS is a little weird in how it detects file changes in `/etc/resolver/` and\nopening and closing the file with `vim` triggers a swap file create/delete which tricks MacOS into seeing the changes.\n\n## HTTPS/TLS Support\n\nThis repo has full support for running your services on HTTPS/TLS locally using the same subdomains that we use\nfor our services in staging and production environments. In order to enable TLS support, run `docker-compose up -d`\nand then after that `cd` into the `tls` directory and run `bash generate-certs.sh`. This will generate a\nCertificate Authority and a wildcard certificate for `pager.localhost` and `*.pager.localhost` using SNI.\n\nAfter this, still in the `tls` directory, you can run `bash register-certs-with-kong.sh` to load the certificates\ninto Kong and register them for use with `*.pager.localhost` domains.\n\n*NOTE:* Every time you run `deck sync` with Kong, it will wipe out the certs from the Kong DB. Simply re-run the\n`register-certs-with-kong.sh` script to re-add them.\n\n[compose-file]: https://docs.docker.com/compose/compose-file/\n[dotfiles]: https://github.com/pagerinc/dotfiles\n[docker-mac]: https://www.docker.com/products/docker#/mac\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpagerinc%2Fcomposer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpagerinc%2Fcomposer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpagerinc%2Fcomposer/lists"}