gifski icon indicating copy to clipboard operation
gifski copied to clipboard

Tips on installing gifski on a heroku nodejs server

Open AustinHatem opened this issue 5 years ago • 6 comments

Hello, I am fairly new to gifski and I'm trying to get it setup on my heroku node js server. I am trying to start it with a child_process command.

const util = require('util'); const exec = util.promisify(require('child_process').exec);

then trying to start it: const { stdout, stderr } = await exec(gifski);

I'm having issues getting it working. Is this how someone would go about doing this? Any tips would be much appreciated!

AustinHatem avatar Oct 28 '20 20:10 AustinHatem

Can you describe the problem you have?

kornelski avatar Oct 28 '20 21:10 kornelski

So I think my main issue is just installing gifski on heroku : 2020-10-28T22:38:04.093580+00:00 app[web.1]: /bin/sh: 1: gifski: not found

Since there is no buildpack for heroku I've been trying to use the .deb file to upload it to heroku. Would be nice in the future to have a buildpack but hopefully I can figure this out without it.

AustinHatem avatar Oct 28 '20 22:10 AustinHatem

/bin/sh: 1: gifski: not found means you haven't got gifski command in your path, i.e. it's not installed. You need to upload gifski binary to your server and either put it somewhere it expects it (e.g. /usr/bin) or update PATH variable with its location, or use an absolute path to the executable.

I can't help you with Heroku-specific problems. You need to ask them how they want executables to be uploaded/installed.

kornelski avatar Oct 29 '20 15:10 kornelski

For anybody else wondering how to install gifski on Heroku:

  1. Add a working rust buildpack to your dyno:
heroku buildpacks:add https://github.com/vinceliu/heroku-buildpack-rust
  1. Add a Cargo.toml file to the root of your project and list gifski as a dependency:
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gifski = "1.7.0"

techpeace avatar Aug 19 '22 17:08 techpeace

Note that adding via [dependencies] installs a Rust-only library, and does NOT install the command-line version.

kornelski avatar Aug 19 '22 19:08 kornelski

Thanks, @kornelski! I (clearly) don't have any Rust experience.

I ended up using heroku-buildpack-apt and defining an Aptfile in the root of my project that lists a link to the .deb from the latest release

https://github.com/ImageOptim/gifski/releases/download/1.7.1/gifski_1.7.1_amd64.deb

techpeace avatar Aug 23 '22 16:08 techpeace