{"id":13464935,"url":"https://github.com/Osedea/nodock","last_synced_at":"2025-03-25T12:33:18.404Z","repository":{"id":70794971,"uuid":"69291747","full_name":"Osedea/nodock","owner":"Osedea","description":"Docker Compose for Node projects with Node, MySQL, Redis, MongoDB, NGINX, Apache2, Memcached, Certbot and RabbitMQ images","archived":false,"fork":false,"pushed_at":"2020-09-22T20:19:19.000Z","size":383,"stargazers_count":762,"open_issues_count":20,"forks_count":190,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-07-31T14:10:18.278Z","etag":null,"topics":["apache","certbot","cron-jobs","docker","docker-compose","docker-images","docker-node","memcached","nginx-server","node","node-docker","node-mysql","node-nginx","nodejs","postgresql","rabbitmq","redis","workspace"],"latest_commit_sha":null,"homepage":"http://nodock.io","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/Osedea.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null}},"created_at":"2016-09-26T20:51:07.000Z","updated_at":"2024-07-22T14:59:48.000Z","dependencies_parsed_at":"2023-03-07T11:00:47.128Z","dependency_job_id":null,"html_url":"https://github.com/Osedea/nodock","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fnodock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fnodock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fnodock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Osedea%2Fnodock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Osedea","download_url":"https://codeload.github.com/Osedea/nodock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245463055,"owners_count":20619603,"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":["apache","certbot","cron-jobs","docker","docker-compose","docker-images","docker-node","memcached","nginx-server","node","node-docker","node-mysql","node-nginx","nodejs","postgresql","rabbitmq","redis","workspace"],"created_at":"2024-07-31T14:00:53.048Z","updated_at":"2025-03-25T12:33:17.538Z","avatar_url":"https://github.com/Osedea.png","language":"Shell","readme":"![NoDock](https://raw.githubusercontent.com/Osedea/nodock/master/docs/images/logo.png)\n\nDocker Compose for Node projects with Node, MySQL, MongoDB, NGINX, Memcached, Redis, Certbot and RabbitMQ images\n\n![Node + Docker](https://raw.githubusercontent.com/Osedea/nodock/master/docs/images/nodock.jpg)\n\n\u003ca name=\"why-nodock\"\u003e\u003c/a\u003e\n## Why NoDock?\n\nThe [docker Node.js](https://github.com/nodejs/docker-node) image is very simple, you give it an entrypoint and it runs it. This is fine for very simple/small scripts but for larger projects you'll probably want something a bit more robust.\n\nThe goal of NoDock is to provide a complete environment for your node project: Node.js service(s), databases, web servers, queues, etc. while doing the \"wiring\" for you.\n\nYou can use NoDock for simple projects by using one of the [examples](#Examples) or you can build upon them.\n\n## Contents\n\n- [Requirements](#Requirements)\n- [Installation](#Installation)\n- [Usage](#Usage)\n- [Examples](#Examples)\n- [Workspace](#Workspace)\n- [HTTPS](#HTTPS)\n    - [Self-signed certificates](#SelfSigned)\n    - [Certbot](#Certbot)\n- [Non-web project](#Non-Web)\n- [Multiple Node containers](#Multi-Node)\n- [More options](#More-Options)\n    - [Use Yarn](#Use-Yarn)\n    - [Change Node entrypoint](#Node-Entrypoint)\n    - [Change Node environment](#Node-Environment)\n    - [Change Node version](#Node-Version)\n    - [Change Node project location](#Node-Project-Path)\n    - [Change MySQL database/user/password](#MySQL-Database-User)\n    - [Change PostgreSQL database/user/password](#PostgreSQL-Database-User)\n    - [Change NGINX reverse proxy port](#NGINX-Reverse-Proxy-Port)\n    - [Change the timezone](#Change-the-timezone)\n    - [Use RabbitMQ plugins](#Use-RabbitMQ-plugins)\n    - [Change the RabbitMQ user/password](#Change-RabbitMQ-User)\n    - [Modify Redis config](#Modify-Redis-Config)\n- [Contributing](#Contributing)\n- [License](#License)\n- [Credits](#credits)\n\n\u003ca name=\"Requirements\"\u003e\u003c/a\u003e\n## Requirements\n\n* [Docker Engine 17.06+](https://docs.docker.com/engine/installation/)\n* [Docker Compose 1.8+](https://docs.docker.com/compose/install/)\n\n\u003ca name=\"Installation\"\u003e\u003c/a\u003e\n## Installation\nAs a git submodule:\n```bash\ngit submodule add https://github.com/Osedea/nodock.git\n```\n\nClone into your project:\n```bash\ngit clone https://github.com/Osedea/nodock.git\n```\n\nWe recommend you [fork this repository](https://github.com/Osedea/nodock#fork-destination-box) if you intend to add project specific scripts/configurations.\n\n\u003ca name=\"Usage\"\u003e\u003c/a\u003e\n## Usage\n```bash\ncd nodock\n# Run \"node\" and \"nginx\"\ndocker-compose up -d node nginx\n```\n\nTo overwrite the `docker-compose.yml` file you can use a `docker-compose.override.yml`\n\n```yaml\n# docker-compose.override.yml\n\nversion: '3'\n\nservices:\n    [...]\n```\n\u003ca name=\"Examples\"\u003e\u003c/a\u003e\n## Examples\nWe provide examples of configurations you might use for a specific stack. Each example has it's own README file with instructions.\n\n* [Simple Web with Apache](https://github.com/Osedea/nodock/tree/master/_examples/apache) - Node + Apache\n* [Simple Web with Nginx](https://github.com/Osedea/nodock/tree/master/_examples/nginx) - Node + NGINX\n* [MySQL](https://github.com/Osedea/nodock/tree/master/_examples/mysql) - MySQL + Node + NGINX\n* [PostgreSQL](https://github.com/Osedea/nodock/tree/master/_examples/postgresql) - PostgreSQL + Node + NGINX\n* [Mongo](https://github.com/Osedea/nodock/tree/master/_examples/mongo) - MongoDB + Node + NGINX\n* [RabbitMQ](https://github.com/Osedea/nodock/tree/master/_examples/rabbitmq) - RabbitMQ + Node + NGINX\n* [Memcached](https://github.com/Osedea/nodock/tree/master/_examples/memcached) - Memcached + Node + NGINX\n* [Redis](https://github.com/Osedea/nodock/tree/master/_examples/redis) - Redis + Node + NGINX\n* [RethinkDB](https://github.com/Osedea/nodock/tree/master/_examples/rethinkdb) - RethinkDB + Node + NGINX\n* [2 Node Apps](https://github.com/Osedea/nodock/tree/master/_examples/2-nodes) - Node + Node + NGINX\n\n\u003ca name=\"Workspace\"\u003e\u003c/a\u003e\n## Workspace\nThe `workspace` container is where you want to be manually running commands for `NoDock`. You can use this container to initialize your project, for task-automation, for [cronjobs](#Cronjobs), etc.\n\n\u003ca name=\"HTTPS\"\u003e\u003c/a\u003e\n## Using HTTPS\nBy default HTTPS is disabled. To enable it, you may use the following settings\n\n```yaml\n# docker-compose.override.yml\n[...]\n    nginx:\n        build:\n            args:\n                - WEB_SSL=true\n```\nAdd your certificate to `nginx/certs/cacert.pem` and the private key to `nginx/certs/privkey.pem`.\n\u003ca name=\"SelfSigned\"\u003e\u003c/a\u003e\n#### Generate and use a self-signed cert\n`SELF_SIGNED: \"true\"` will generate the necessary files, do note that `SELF_SIGNED: \"true\"` as no effect if `WEB_SSL: \"false\"`\n\n```yaml\n# docker-compose.override.yml\n[...]\n    nginx:\n        build:\n            args:\n                - WEB_SSL=true\n                - SELF_SIGNED=true\n```\n\u003ca name=\"Certbot\"\u003e\u003c/a\u003e\n#### Use Certbot (Let's Encrypt) to generate the cert\n`CN` must be a publicly accessible address and `EMAIL` should be the server admin contact email.\n\n```yaml\n# docker-compose.override.yml\n[...]\n    nginx:\n        build:\n            args:\n                - WEB_SSL=true\n    certbot:\n        environment:\n            - CN=example.com\n            - EMAIL=fake@gmail.com\n```\nDon't forget to bring up the container if you plan on using certbot (`docker-compose up -d certbot`).\n\u003ca name=\"Non-Web\"\u003e\u003c/a\u003e\n## Running a single non-web container\nThe default NGINX server block configuration is aimed at web projects but if you want to have a single non-web container you can do something similar to the following configuration.\n\n```yaml\n# docker-compose.override.yml\n[...]\n    nginx:\n        build:\n            args:\n                -NO_DEFAULT=true\n        ports:\n            - \"10000:10000\"\n```\n\nDo note that using `NO_DEFAULT` makes `WEB_REVERSE_PROXY_PORT`, `WEB_SSL` and `SELF_SIGNED` have no effect.\n\nYou will then have to provide your own NGINX server block like so\n\n```\n# nginx/sites/custom-node.conf\n\nserver {\n    listen 10000 default_server;\n\n    location / {\n        proxy_pass http://node:5000;\n    }\n}\n```\n\u003ca name=\"Multi-Node\"\u003e\u003c/a\u003e\n## Running multiple node containers\nTo add more node containers, simply add the following to your `docker-compose.override.yml` or environment specific docker-compose file.\n\n```yaml\n# docker-compose.override.yml\n[...]\n    node2: # name of new container\n        build:  # reuse the same values from the node service, cannot use extends in docker-compose 3+\n            context: ./node\n            args:\n                - NODE_VERSION=latest\n                - PROJECT_PATH=/opt/app/\n                - NODE_ENV=production\n                - YARN=false\n        volumes:\n            - ../:/opt/app\n        entrypoint: run-nodock \"node alternate.js\" # the entrypoint for the \"node2\" container\n    nginx:\n        ports:\n            - \"10000:10000\" # the port(s) to forward for the \"node2\" container\n        links:\n            - node2 # link \"nginx\" to \"node2\"\n```\n\nYou'll also need to add a server block for \"node2\".\n```\n# nginx/sites/node2.conf\n\nserver {\n    listen 10000 default_server;\n\n    location / {\n        proxy_pass http://node2:8000;\n    }\n}\n```\n\n\u003ca name=\"Cronjobs\"\u003e\u003c/a\u003e\n## Cronjobs\nYou can run cronjobs in the [Workspace](#Workspace) by storing them in the `workspace/crontab/root` file.\n```\n# workspace/crontab/root\n\n* * * * * echo \"Every Minute\" \u003e\u003e /var/log/cron.log\n```\n\n\u003ca name=\"More-Options\"\u003e\u003c/a\u003e\n## More Options\nTo customize the NoDock installation, either add a `docker-compose.override.yml` in the NoDock directory or store environment specific configurations.\n\n```bash\ndocker-compose -f nodock/docker-compose.yml -f docker-compose.dev.yml up -d\n```\n\u003ca name=\"Use-Yarn\"\u003e\u003c/a\u003e\n#### Use Yarn\nSet the `YARN` argument to `true`.\n```yaml\n# docker-compose.override.yml\n[...]\n    node:\n        build:\n            args:\n                - YARN=true\n```\n\u003ca name=\"Node-Entrypoint\"\u003e\u003c/a\u003e\n#### Change the node entrypoint\nUse `main.js` instead of `index.js`\n```yaml\n# docker-compose.override.yml\n[...]\n    node:\n        entrypoint: run-nodock \"node main.js\"\n```\n\u003ca name=\"Node-Environment\"\u003e\u003c/a\u003e\n#### Change the Node Environment\nThe default `NODE_ENV` value is `production`, you can change it to development by doing the following\n```yaml\n# docker-compose.override.yml\n[...]\n    node:\n        build:\n            args:\n                - NODE_ENV=development\n```\n\u003ca name=\"Node-Version\"\u003e\u003c/a\u003e\n#### Use a specific Node version\nThe default node version is `latest`, this is **NOT** advisable for production\n```yaml\n# docker-compose.override.yml\n[...]\n    node:\n        build:\n            args:\n                - NODE_VERSION=4.6.0\n```\n\u003ca name=\"Node-Project-Path\"\u003e\u003c/a\u003e\n#### Change the Node project path\nYou can specify a `PROJECT_PATH` to change the directory in which `npm` will perform it's `install` command and the directory in which `run-nodock` will run the entrypoint script. This is most desirable when running more than one Node project at a time since they are bound to each have their own `package.json` file.\n```yaml\n# docker-compose.override.yml\n[...]\n    node:\n        build:\n            args:\n                PROJECT_PATH: somefolder # note that this is the same as \"/opt/app/somefolder\"\n\n```\n\u003ca name=\"MySQL-Database-User\"\u003e\u003c/a\u003e\n#### Change the MySQL database/user/password\n```yaml\n# docker-compose.override.yml\n[...]\n    mysql:\n        build:\n            args:\n                - MYSQL_DATABASE=default_database\n                - MYSQL_USER=default_user\n                - MYSQL_PASSWORD=secret\n```\n\u003ca name=\"PostgreSQL-Database-User\"\u003e\u003c/a\u003e\n#### Change the PostgreSQL database/user/password\n```yaml\n# docker-compose.override.yml\n[...]\n    postgresql:\n        build:\n            args:\n                - POSTGRES_DB=default_db\n                - POSTGRES_USER=default_user\n                - POSTGRES_PASSWORD=secret\n```\n\n\n\n\u003ca name=\"NGINX-Reverse-Proxy-Port\"\u003e\u003c/a\u003e\n#### Change the NGINX reverse proxy port\nUse port `8080` instead of `8000` to bind your Node server\n```yaml\n# docker-compose.override.yml\n[...]\n    nginx:\n        build:\n            args:\n                - WEB_REVERSE_PROXY_PORT=8080\n```\n\u003ca name=\"Change-the-timezone\"\u003e\u003c/a\u003e\n#### Change the timezone\n\nTo change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).\n\nFor example, if I want the timezone to be `New York`:\n```yaml\n# docker-compose.override.yml\n[...]\n     workspace:\n        build:\n            context: ./workspace\n            args:\n                - TZ=\"America/New_York\"\n```\n\u003ca name=\"Use-RabbitMQ-plugins\"\u003e\u003c/a\u003e\n#### Use RabbitMQ plugins\nAt the moment, NoDock supports 2 plugins: [Management](https://www.rabbitmq.com/management.html) and [Federation](https://www.rabbitmq.com/federation.html).\n\nTo activate them, change their values to `true` in your docker-compose file:\n```yaml\n# docker-compose.override.yml\n[...]\n    rabbitmq:\n        build:\n            args:\n                - MANAGEMENT=true\n                - FEDERATION=true\n```\n\u003ca name=\"Change-RabbitMQ-User\"\u003e\u003c/a\u003e\n#### Change the RabbitMQ user/password\n```yaml\n# docker-compose.override.yml\n[...]\n    rabbitmq:\n        build:\n            args:\n                - RABBITMQ_DEFAULT_USER=custom_user\n                - RABBITMQ_DEFAULT_PASS=custom_pass\n```\n\u003ca name=\"Modify-Redis-Config\"\u003e\u003c/a\u003e\n#### Modify the Redis config\nYou can edit `redis/redis.conf` to modify the redis config.\n\n\u003ca name=\"Contributing\"\u003e\u003c/a\u003e\n## Contributing\nDo not hesitate to contribute to NoDock by creating an issue, fixing a bug or bringing a new idea to the table.\n\nTo fix a bug or introduce a new feature, please create a PR, we will merge it in to the `master` branch after review.\n\nWe thank you in advance for contributing.\n\u003ca name=\"License\"\u003e\u003c/a\u003e\n## License\n[MIT License](https://github.com/laradock/laradock/blob/master/LICENSE) (MIT)\n\u003ca name=\"credits\"\u003e\u003c/a\u003e\n## Credits\nNoDock uses Open Source components. You can find the source code of their open source projects along with license information below. We acknowledge and are grateful to these developers for their contributions to open source.\n\nProject: LaraDock https://github.com/LaraDock/laradock \u003cbr\u003e\nCopyright (c) 2016 Mahmoud Zalt (mahmoud@zalt.me) \u003cbr\u003e\nLicense (MIT) https://github.com/LaraDock/laradock/blob/master/LICENSE \u003cbr\u003e\n\nProject: baseimage-docker https://github.com/phusion/baseimage-docker \u003cbr\u003e\nCopyright (c)  2013-2015 Phusion Holding B.V. \u003cbr\u003e\nLicense (MIT) https://github.com/phusion/baseimage-docker/blob/master/LICENSE.txt \u003cbr\u003e\n","funding_links":[],"categories":["Shell","redis"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOsedea%2Fnodock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOsedea%2Fnodock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOsedea%2Fnodock/lists"}