Postleaf / postleaf

Simple, beautiful publishing with Node.js.
https://www.postleaf.org/
MIT License
505 stars 203 forks source link

Example CentOS 7 release #35

Closed abecks closed 7 years ago

abecks commented 7 years ago

Summary

This is an example attempt at building a contained release of Postleaf and all dependencies for CentOS 7.

https://drive.google.com/open?id=0Bw79xAK-G5jhQTNnNmoxcGxxWXc

Installation:

wget https://drive.google.com/open?id=0Bw79xAK-G5jhQTNnNmoxcGxxWXc
tar -zxvf postleaf-centos-7.3.tar.gz
cd postleaf
cp .env-example .env
nano .env // setup your env settings
chmod +x run.sh
./run.sh // sets PATH variables, calls node from bin directory

The only dependency missing from this example is sqlite, which is installed by default on DigitalOcean droplets.

With this technique you can create a build process for each major server OS. You can bake in all dependencies and assets post-gulp build. This greatly simplifies the installation process.

How it works:

First, install Postleaf on the target OS normally, including all dependencies (node, sqlite, gm, etc.) Move all dependency binaries to a folder inside the postleaf project (I used bin)

Write a startup script to modify the PATH environment variable for the node process (see run.sh) to include the bin directory. Now all calls to binaries like GM will look inside our bin folder first.

Note we also use our local node binary instead of the globally installed Node. This is a big deal since many node-based projects require different versions of node, they really need to bundle their preferred version to avoid conflicts. Really important if you want to run more than one node app on the same box.

We might be able to get rid of run.sh if we can set the PATH environment variable at runtime (top of app.js). Not sure about this.

We should check the licensing on GM to make sure it can be bundled legally, and make sure we include the license alongside the binary if necessary.

claviska commented 7 years ago

GraphicsMagick is MIT, so bundling is fine: http://www.graphicsmagick.org/Copyright.html

I'll look at this more closely when I get back.

claviska commented 7 years ago

Ok, the latest release (alpha 3) should fix most of the installation issues folks were having. I still only test on macOS and Ubuntu at the moment (supporting every platform is way too time consuming), but I'm open to posting a tutorial for other major distros such as CentOS if you want to write one. Otherwise, edge cases for those platforms will have to be sorted out by end users.

By the time we reach stable, the installation process will probably change completely, so I'd like to stay focused on dev until then :)