{"id":13443022,"url":"https://github.com/vladholubiev/serverless-libreoffice","last_synced_at":"2025-04-05T12:01:32.404Z","repository":{"id":26900687,"uuid":"110362573","full_name":"vladholubiev/serverless-libreoffice","owner":"vladholubiev","description":"Run LibreOffice in AWS Lambda to create PDFs \u0026 convert documents","archived":false,"fork":false,"pushed_at":"2023-03-04T21:57:26.000Z","size":67,"stargazers_count":518,"open_issues_count":22,"forks_count":75,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-12-27T21:02:41.327Z","etag":null,"topics":["aws-lambda","javascript","libreoffice","nodejs","pdf","pdf-conversion","pdf-converter","serverless","terraform"],"latest_commit_sha":null,"homepage":"https://vladholubiev.com/serverless-libreoffice","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladholubiev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://send.monobank.ua/2A11P2NhMq"]}},"created_at":"2017-11-11T16:49:47.000Z","updated_at":"2024-12-03T10:35:28.000Z","dependencies_parsed_at":"2023-09-22T04:17:26.033Z","dependency_job_id":null,"html_url":"https://github.com/vladholubiev/serverless-libreoffice","commit_stats":null,"previous_names":["vladholubiev/serverless-libreoffice","vladgolubev/serverless-libreoffice"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladholubiev%2Fserverless-libreoffice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladholubiev%2Fserverless-libreoffice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladholubiev%2Fserverless-libreoffice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladholubiev%2Fserverless-libreoffice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladholubiev","download_url":"https://codeload.github.com/vladholubiev/serverless-libreoffice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332555,"owners_count":20921853,"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":["aws-lambda","javascript","libreoffice","nodejs","pdf","pdf-conversion","pdf-converter","serverless","terraform"],"created_at":"2024-07-31T03:01:54.928Z","updated_at":"2025-04-05T12:01:32.362Z","avatar_url":"https://github.com/vladholubiev.png","language":"Dockerfile","funding_links":["https://send.monobank.ua/2A11P2NhMq"],"categories":["Dockerfile"],"sub_categories":[],"readme":"# Serverless LibreOffice\n\n# UPD 2022-06\n\u003e See [libreoffice-lambda-base-image](https://github.com/shelfio/libreoffice-lambda-base-image) \u0026 [aws-lambda-libreoffice](https://github.com/shelfio/aws-lambda-libreoffice) for the latest updates\n\n[![](https://cdn-images-1.medium.com/max/1600/1*4q_I8VM6Gtmtw6TAjORylA.png)](https://vladholubiev.com/serverless-libreoffice)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://medium.com/@vladholubiev/how-to-run-libreoffice-in-aws-lambda-for-dirty-cheap-pdfs-at-scale-b2c6b3d069b4\"\u003e\n    👉🏻 Read the blog post on Medium: How to Run LibreOffice in AWS Lambda for Dirty-Cheap PDFs at Scale 👈🏻\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# Show Me the Code\n\nThis repo contains code used to run the [online demo](https://vladholubiev.com/serverless-libreoffice).\n\n```\n├── compile.sh  \u003c-- commands used to compile LibreOffice for Lambda\n├── infra       \u003c-- terraform config to deploy example Lambda\n│   ├── iam.tf\n│   ├── lambda.tf\n│   ├── main.tf\n│   ├── s3.tf\n│   └── vars.tf\n└── src         \u003c-- example Lambda function node in Node.js used for website demo\n    ├── handler.js\n    ├── libreoffice.js\n    ├── logic.js\n    ├── package.json \u003c-- put lo.tar.gz in this folder to deploy. Download it below\n    └── s3.js\n```\n\nCompiled and ready to use archive can be downloaded under [Releases section](https://github.com/vladgolubev/serverless-libreoffice/releases). Also check out [NPM package with bundled LibreOffice for Lambda (85 MB)](https://github.com/shelfio/aws-lambda-libreoffice).\n\n✨ Check out a new [Lambda Layer with LibreOffice](https://github.com/shelfio/libreoffice-lambda-layer)!\n\n# How to compile by yourself\n\n\u003e Check out a comprehensive [step-by-step tutorial](STEP_BY_STEP.md) from 0 to deployed function.\n\nTo run this, you will need to [Docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed.\n\n1. Install and configure Docker and docker-compose locally or on a `c5.2xlarge` spot instance with ~ 8 GB (the default) of storage attached.\n1. In a terminal, run `docker-compose run --rm libreoffice`. It will compile LibreOffice and then copy layers.zip to your local drive.\n\n# Help\n\n- [List of RPM Packages available in AWS Lambda](https://gist.github.com/vladgolubev/1dac4ed47a5febf110c668074c6b671c)\n- [List of Libraries available in AWS Lambda](https://gist.github.com/vladgolubev/439559fc7597a4fb51eaa9e97b72f319)\n\n# Related Projects\n\n- [Docker in AWS Lambda](https://github.com/vladgolubev/docker-in-aws-lambda)\n- [NPM package with bundled LibreOffice for Lambda (85 MB)](https://github.com/shelfio/aws-lambda-libreoffice)\n- [Lambda Layer with LibreOffice](https://github.com/shelfio/libreoffice-lambda-layer)\n\n# How To Help\n\n## Reduce Cold Start Time\n\nCurrently ƛ unpacks 109 MB .tar.gz to `/tmp` folder which takes ~1-2 seconds on cold start.\n\nWould be nice to create a single compressed executable to save unpack time and increase portability.\nI tried using [Ermine](http://www.magicermine.com/) packager and it works!!\nBut unfortunately this is commercial software.\nSimilar open-source analogue [Statifier](http://statifier.sourceforge.net/) produces broken binaries.\n\nMaybe someone has another idea how to create a single executable from a folder full of shared objects.\n\n**UPD:** TODO: Check out [node-packer](https://github.com/pmq20/node-packer) and [libsquash](https://github.com/pmq20/libsquash) (no FUSE required!)\n\n## Further Size Reduction\n\nI am not a Linux or C++ expert, so for sure I missed some easy \"hacks\"\nto reduce size of compiled LibreOffice.\n\nMostly I just excluded from compilation as much unrelated stuff as possible.\nAnd stripped symbols from shared objects.\n\nHere is the list of: [available RPM packages](https://gist.github.com/vladgolubev/1dac4ed47a5febf110c668074c6b671c)\nand [libraries](https://gist.github.com/vladgolubev/439559fc7597a4fb51eaa9e97b72f319)\navailable in AWS Lambda Environment, which can be helpful.\n\nYou can also use multi compression level, with upx and then decompress after brotli.\n\n## Testing\n\nUpdate repo for testing. Return before S3 for example, hardcode or generate files to convert and setup variables. Then simply run:\n\n```\ndocker run \\\n -v \"\\$PWD\":/var/task \\\n lambci/lambda:nodejs12.x src/handler.handler\n```\n\nAfter successful execution, get the resulted files to check the pdfs.\n\n```\ndocker ps -a\n```\n\nFind exect container id.\n\nThen execute\n\n```\ndocker cp containerId:/tmp/filename.pdf ./filename.pdf\n```\n\nThen check your results locally\n\n## License\n\nMIT © [Vlad Holubiev](https://vladholubiev.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladholubiev%2Fserverless-libreoffice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladholubiev%2Fserverless-libreoffice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladholubiev%2Fserverless-libreoffice/lists"}