{"id":17443082,"url":"https://github.com/adrianrudnik/mjml-server","last_synced_at":"2025-03-01T20:31:02.246Z","repository":{"id":47342031,"uuid":"167414166","full_name":"adrianrudnik/mjml-server","owner":"adrianrudnik","description":"Standalone mjml server, listening on port 80/tcp. ","archived":false,"fork":false,"pushed_at":"2023-09-17T12:04:29.000Z","size":186,"stargazers_count":19,"open_issues_count":6,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-23T22:11:14.997Z","etag":null,"topics":["docker","microservice","mjml"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/adrianrudnik/mjml-server","language":"JavaScript","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/adrianrudnik.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}},"created_at":"2019-01-24T18:13:52.000Z","updated_at":"2024-04-18T08:03:19.000Z","dependencies_parsed_at":"2023-09-22T15:41:46.623Z","dependency_job_id":null,"html_url":"https://github.com/adrianrudnik/mjml-server","commit_stats":{"total_commits":45,"total_committers":5,"mean_commits":9.0,"dds":0.5333333333333333,"last_synced_commit":"57890384267ea775f5831a6d5d521533f26152c6"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Fmjml-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Fmjml-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Fmjml-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianrudnik%2Fmjml-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianrudnik","download_url":"https://codeload.github.com/adrianrudnik/mjml-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241421043,"owners_count":19960213,"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","microservice","mjml"],"created_at":"2024-10-17T16:43:22.782Z","updated_at":"2025-03-01T20:31:01.983Z","avatar_url":"https://github.com/adrianrudnik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MJML docker microservice / server\n\nStandalone mjml server, listening on port 80/tcp.\n\nDue to various challenges this image sports the following features:\n\n- Clean and fast shutdowns on docker.\n- Simple CORS capabilities.\n- Small footprint (at least in a npm way).\n- Supports healthchecks.\n\n# Table of contents\n\n- [Overview](#overview)\n- [Defaults](#defaults)\n- [Development](#development)\n- [Troubleshooting](#troubleshooting)\n  - [Kubernetes](#kubernetes)\n\n## Overview\n\nThis image spools up a simple mjml server instance, listening to port 80/tcp per default.\n\nDue to GDPR / DSGVO reasons I required the mjml instance to be under my own control, as the processing personal information is processed in mail content generation.\n\nStarting the image is as easy as running a test instance through docker\n\n```sh\ndocker run -it --rm -p 8080:80 adrianrudnik/mjml-server\n```\n\nor `docker-compose` with the following example:\n\n```yml\nservices:\n  mjml:\n    image: adrianrudnik/mjml-server\n    ports:\n      - 8080:80\n    # environment:\n    # to change the port:\n    #   - PORT=8080\n    # for development, uncomment the following lines:\n    #   - CORS=*\n    #   - MJML_KEEP_COMMENTS=true\n    #   - MJML_VALIDATION_LEVEL=strict\n    #   - MJML_MINIFY=false\n    #   - MJML_BEAUTIFY=true\n```\n\n## Defaults\n\nThe production defaults, without any override, default to:\n\n```sh\nCORS \"\"\nMJML_KEEP_COMMENTS \"false\"\nMJML_VALIDATION_LEVEL \"soft\"\nMJML_MINIFY \"true\"\nMJML_BEAUTIFY \"false\"\nHEALTHCHECK \"true\"\nCHARSET=\"utf8\"\nDEFAULT_RESPONSE_CONTENT_TYPE=\"text/html; charset=utf-8\"\n```\n\n## Development\n\nFor development environments I would suggest to switch it to\n\n```sh\nCORS \"*\"\nMJML_KEEP_COMMENTS \"true\"\nMJML_VALIDATION_LEVEL \"strict\"\nMJML_MINIFY \"false\"\nMJML_BEAUTIFY \"true\"\nHEALTHCHECK \"false\"\n```\n\nThis will escalate any issues you have with invalid mjml code to the docker log (`stdout` or `docker-compose logs`).\n\n## Troubleshooting\n\nMake sure you pass along a plain Content-Type header and pass the mjml as raw body.\n\nCatch errors by looking at the HTTP response code.\n\n### Kubernetes\n\nAs the default Dockerfile specific `HEALTHCHECK` directive is not supported by kubernetes, you might need to specify your own probes:\n\n```\nspec:\n  containers:\n  - name: ...\n    livenessProbe:\n      exec:\n        command:\n        - curl - -X POST - 'http://localhost:80/'\n      initialDelaySeconds: 30\n      periodSeconds: 30\n    readinessProbe:\n      exec:\n        command:\n        - curl - -X POST - 'http://localhost:80/'\n      initialDelaySeconds: 25\n```\n\nBe aware that this does only check the connectivity and that the port might vary. If you want a functional check as well, you could shift to an approach like the ones used for docker with the result of the [healthcheck.sh](healthcheck.sh). But I'm not a kubernetes user, so feel free to do a pull request if you have a slim approach.\n\n### Docker\n\nIf you want to rely on the Makefile or build for multiple architectures, ensure you have the experimental features activated for Docker and you can use [docker buildx](https://docs.docker.com/buildx/working-with-buildx/).\n\nSetup on my Ubuntu 20.04 workstation was as follows, based on the docs mentioned above:\n\n```bash\n# Install additional platforms for the default node on the current host linux os\ndocker run --privileged --rm tonistiigi/binfmt --install all\n\n# create a separate endpoint that uses the default node\ndocker buildx create --use mjml-server default\n\n# After that a local build should be possible with something like\ndocker buildx build -f Dockerfile --platform linux/amd64,linux/arm64 -t [registry-and-tag] --push .\n\n# ... or if you want to use it locally with the mjml-server tag\ndocker buildx build -f Dockerfile --platform linux/amd64,linux/arm64 -t mjml-server --load .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianrudnik%2Fmjml-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianrudnik%2Fmjml-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianrudnik%2Fmjml-server/lists"}