Code Monkey home page Code Monkey logo

serverless-libreoffice's Introduction

Serverless LibreOffice

πŸ‘‰πŸ» Read the blog post on Medium: How to Run LibreOffice in AWS Lambda for Dirty-Cheap PDFs atΒ Scale πŸ‘ˆπŸ»

Show Me the Code

This repo contains code used to run the online demo.

β”œβ”€β”€ compile.sh  <-- commands used to compile LibreOffice for Lambda
β”œβ”€β”€ infra       <-- terraform config to deploy example Lambda
β”‚Β Β  β”œβ”€β”€ iam.tf
β”‚Β Β  β”œβ”€β”€ lambda.tf
β”‚Β Β  β”œβ”€β”€ main.tf
β”‚Β Β  β”œβ”€β”€ s3.tf
β”‚Β Β  └── vars.tf
└── src         <-- example Lambda function node in Node.js used for website demo
    β”œβ”€β”€ handler.js
    β”œβ”€β”€ libreoffice.js
    β”œβ”€β”€ logic.js
    β”œβ”€β”€ package.json <-- put lo.tar.gz in this folder to deploy. Download it below
    └── s3.js

Compiled and ready to use archive can be downloaded under Releases section. Also check out NPM package with bundled LibreOffice for Lambda (85 MB)

How to compile by yourself

Check out a comprehensive step-by-step tutorial from 0 to deployed function.

  1. Go to Lambda Execution Environment and Available Libraries page to get the latest AMI id
  2. Click on this link to get AMI id for your region
  3. Spin up a c5.2xlarge spot instance with ~ 100 GB of storage attached
  4. Follow the steps in compile.sh file in the repo

Help

Related Projects

How To Help

Reduce Cold Start Time

Currently Ζ› unpacks 109 MB .tar.gz to /tmp folder which takes ~1-2 seconds on cold start.

Would be nice to create a single compressed executable to save unpack time and increase portability. I tried using Ermine packager and it works!! But unfortunately this is commercial software. Similar open-source analogue Statifier produces broken binaries.

Maybe someone has another idea how to create a single executable from a folder full of shared objects.

UPD: TODO: Check out node-packer and libsquash (no FUSE required!)

Further Size Reduction

I am not a Linux or C++ expert, so for sure I missed some easy "hacks" to reduce size of compiled LibreOffice.

Mostly I just excluded from compilation as much unrelated stuff as possible. And stripped symbols from shared objects.

Here is the list of: available RPM packages and libraries available in AWS Lambda Environment, which can be helpful.

License

MIT Β© Vlad Holubiev

serverless-libreoffice's People

Contributors

vladholubiev avatar vladgolubev avatar renovate-bot avatar knupman avatar dehli avatar

Watchers

James Cloos avatar Matt P avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.