Giter Club home page Giter Club logo

heroku-slugs's Introduction

Heroku Slugs CLI Plugin

This plugin adds commands to the Heroku CLI for downloading slugs

To Install

$ heroku plugins:install heroku-slugs

Commands

$ heroku slugs -a appname
Slugs in appname
v24: 00000000-bbbb-cccc-dddd-eeeeeeeeeeee
v23: 11111111-bbbb-cccc-dddd-eeeeeeeeeeee
v22: 22222222-bbbb-cccc-dddd-eeeeeeeeeeee
v21: 33333333-bbbb-cccc-dddd-eeeeeeeeeeee

$ heroku slugs:download 00000000-bbbb-cccc-dddd-eeeeeeeeeeee -a appname

This will download the Slug directly from our filestore on S3

Using a proxy

$ export HEROKU_HTTP_PROXY_HOST=<your-proxy-host>
$ export HEROKU_HTTP_PROXY_PORT=<your-proxy-port>
$ heroku slugs:download 00000000-bbbb-cccc-dddd-eeeeeeeeeeee -a appname

heroku-slugs's People

Contributors

caseywatts avatar chap avatar edmorley avatar jdx avatar jgwhite avatar phil avatar photonios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-slugs's Issues

`tar: Unrecognized archive format` from `heroku slugs:download`

$ heroku slugs:download -a appname
Downloading... ████████████████████████▏  100% 00:00 20.3MB
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
 ▸    Command failed: tar -xf appname/slug.tar.gz -C appname
 ▸    tar: Unrecognized archive format
 ▸    tar: Error exit delayed from previous errors.
 ▸
$ file appname/slug.tar.gz
appname/slug.tar.gz: Squashfs filesystem, little endian, version 3.1, 21286731 bytes, 7778 inodes, blocksize: 131072 bytes, created: Thu Jun  7 07:46:30 2012

Maybe because app stack is cedar?

Can't install on ARM Mac?

Plugin fails to install on Mac ARM:

% heroku plugins:install heroku-slugs
 ›   Warning: heroku update available from 7.67.1 to 8.0.6.
warning heroku-slugs > [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning Error running install script for optional dependency: "/Users/cymen/.local/share/heroku/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/cymen/.local/share/heroku/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.11.3 found at \"/opt/homebrew/opt/[email protected]/bin/python3.11\"
gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
gyp info spawn args [
gyp info spawn args   '/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/cymen/.local/share/heroku/node_modules/cpu-features/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/cymen/Library/Caches/node-gyp/16.19.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/cymen/Library/Caches/node-gyp/16.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/cymen/Library/Caches/node-gyp/16.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/cymen/.local/share/heroku/node_modules/cpu-features',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  ACTION Configuring dependencies /Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/build/Makefile
-- The C compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/build
  TOUCH Release/obj.target/config_deps.stamp
  ACTION Building dependencies /Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a
[ 11%] Building C object CMakeFiles/utils.dir/src/filesystem.c.o
[ 22%] Building C object CMakeFiles/utils.dir/src/stack_line_reader.c.o
[ 33%] Building C object CMakeFiles/utils.dir/src/string_view.c.o
[ 33%] Built target utils
[ 44%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/hwcaps.c.o
[ 55%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/unix_features_aggregator.c.o
[ 55%] Built target unix_based_hardware_detection
[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h:118:2: error: \"Including cpuinfo_arm.h from a non-arm target.\"
#error \"Including cpuinfo_arm.h from a non-arm target.\"
 ^
1 error generated.
make[3]: *** [CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1
make[2]: *** [CMakeFiles/cpu_features.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/cymen/.local/share/heroku/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a] Error 2
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 22.3.0
gyp ERR! command \"/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/bin/node\" \"/Users/cymen/Library/Application Support/fnm/node-versions/v16.19.0/installation/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /Users/cymen/.local/share/heroku/node_modules/cpu-features
gyp ERR! node -v v16.19.0
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok"
Installing plugin heroku-slugs... installed v1.1.0

Symlink errors from tar extraction on Windows

Using this plugin on Windows resulted in this error:

$ heroku slugs:download -a treeherder-stage
Downloading... ████████████████████████▏  100% 00:00 72.35MB
tar: ./app/.heroku/vendor/lib/libmemcachedutil.so: Cannot create symlink to ‘libmemcachedutil.so.2.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/libhashkit.so: Cannot create symlink to ‘libhashkit.so.2.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libanonymous.so.3: Cannot create symlink to ‘libanonymous.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libanonymous.so: Cannot create symlink to ‘libanonymous.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libplain.so.3: Cannot create symlink to ‘libplain.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libscram.so: Cannot create symlink to ‘libscram.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libgssapiv2.so: Cannot create symlink to ‘libgssapiv2.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libgs2.so.3: Cannot create symlink to ‘libgs2.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libdigestmd5.so: Cannot create symlink to ‘libdigestmd5.so.3.0.0’: No such file or directory
tar: ./app/.heroku/vendor/lib/sasl2/libcrammd5.so: Cannot create symlink to ‘libcrammd5.so.3.0.0’: No such file or directory
tar: ./app/.heroku/python/share/man/man1/python.1: Cannot create symlink to ‘python2.1’: No such file or directory
tar: ./app/.heroku/python/bin/python-config: Cannot create symlink to ‘python2-config’: No such file or directory
tar: ./app/.heroku/python/bin/python: Cannot create symlink to ‘python2’: No such file or directory tar: ./app/.heroku/python/bin/python2-config: Cannot create symlink to ‘python2.7-config’: No such file or directory
tar: ./app/.heroku/python/bin/python2: Cannot create symlink to ‘python2.7’: No such file or directory
tar: ./app/.heroku/python/lib/libsqlite3.so: Cannot create symlink to ‘libsqlite3.so.0.8.6’: No such file or directory
tar: ./app/.heroku/python/lib/pkgconfig/python.pc: Cannot create symlink to ‘python2.pc’: No such file or directory
tar: Exiting with failure status due to previous errors
 !    Command failed: tar -xf treeherder-stage/slug.tar -C treeherder-stage
 !    tar: ./app/.heroku/vendor/lib/x86_64-linux-gnu/libmysqlclient.so: Cannot create symlink to
 !    ‘libmysqlclient.so.20’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/libmemcachedutil.so: Cannot create symlink to
 !    ‘libmemcachedutil.so.2.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/libhashkit.so: Cannot create symlink to ‘libhashkit.so.2.0.0’:
 !    No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libanonymous.so.3: Cannot create symlink to
 !    ‘libanonymous.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libanonymous.so: Cannot create symlink to
 !    ‘libanonymous.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libplain.so.3: Cannot create symlink to
 !    ‘libplain.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libscram.so: Cannot create symlink to ‘libscram.so.3.0.0’: !    No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libgssapiv2.so: Cannot create symlink to
 !    ‘libgssapiv2.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libgs2.so.3: Cannot create symlink to ‘libgs2.so.3.0.0’:
 !    No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libdigestmd5.so: Cannot create symlink to
 !    ‘libdigestmd5.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/vendor/lib/sasl2/libcrammd5.so: Cannot create symlink to
 !    ‘libcrammd5.so.3.0.0’: No such file or directory
 !    tar: ./app/.heroku/python/share/man/man1/python.1: Cannot create symlink to ‘python2.1’: No
 !    such file or directory
 !    tar: ./app/.heroku/python/bin/python-config: Cannot create symlink to ‘python2-config’: No
 !    such file or directory
 !    tar: ./app/.heroku/python/bin/python: Cannot create symlink to ‘python2’: No such file or
 !    directory
 !    tar: ./app/.heroku/python/bin/python2-config: Cannot create symlink to ‘python2.7-config’: No  !    such file or directory
 !    tar: ./app/.heroku/python/bin/python2: Cannot create symlink to ‘python2.7’: No such file or
 !    directory
 !    tar: ./app/.heroku/python/lib/libsqlite3.so: Cannot create symlink to ‘libsqlite3.so.0.8.6’:
 !    No such file or directory
 !    tar: ./app/.heroku/python/lib/pkgconfig/python.pc: Cannot create symlink to ‘python2.pc’: No
 !    such file or directory
 !    tar: Exiting with failure status due to previous errors
 !

This is because Windows doesn't support symlinks.

Possible solutions:

  1. Default to not extracting the archive (see #2) and let the user deal with how they want to extract it.
  2. Pass the --dereference option to tar on Windows (only), to ensure symlinks are followed and converted to real files.

This was using:
heroku-cli/6.11.17-91bdf0b (windows-x64) node-v7.10.0
heroku-slugs 1.0.3

Can't install Windows 10

System: Windows 10 Pro

I tried to install using the command heroku plugins:install heroku-slugs but get the error:

 !    yarn add heroku-slugs@latest --non-interactive
 !    --mutex=file:C:\Users\mr-robot\AppData\Local\heroku\plugins\yarn.lock
 !    --preferred-cache-folder=C:\Users\mr-robot\AppData\Local\heroku\yarn --registry=https://cli-npm.heroku.com exited !    with code 1
 !    error An unexpected error occurred: "https://cli-npm.heroku.com/heroku-slugs: Hostname/IP does not match
 !    certificate's altnames: Host: cli-npm.heroku.com. is not in the cert's altnames: DNS:*.herokuapp.com,
 !    DNS:herokuapp.com".
 !
 !    yarn add v1.6.0
 !    info No lockfile found.
 !    [1/4] Resolving packages...
 !    info If you think this is a bug, please open a bug report with the information provided in
 !    "C:\\Users\\mr-robot\\AppData\\Local\\heroku\\plugins\\yarn-error.log".
 !    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Any help much appreciated.

An additional directory named `-p` is created on Windows

$ ls -al
total 16
drwxr-xr-x 1 Ed None 0 Jun 26 12:18 .
drwxr-xr-x 1 Ed None 0 Jun 26 12:18 ..

$ heroku slugs:download -a treeherder-stage
Downloading... ████████████████████████▏  100% 00:00 72.35MB
...

slugs-test $ ls -al
total 16
drwxr-xr-x 1 Ed None 0 Jun 26 12:16 .
drwxr-xr-x 1 Ed None 0 Jun 26 12:18 ..
drwxr-xr-x 1 Ed None 0 Jun 26 12:16 -p
drwxr-xr-x 1 Ed None 0 Jun 23 10:44 treeherder-stage

This is presumably coming from the mkdir -p ${context.app} here:

exec(`mkdir -p ${context.app}`)

...since Window's mkdir doesn't support the -p option. (Though I'm running the command inside my MSYS2 environment, whose mkdir does support -p. So presumably it's not inheriting the environment. Though for people using cmd.exe this would still occur anyway.)

In this case the -p option isn't actually needed (since there won't be a nested directory structure) so could just be removed entirely. Also I wonder if in general plugins like this should be using the nodejs API (fs.mkdir()) rather than calling OS built-ins?

This was using:
heroku-cli/6.11.17-91bdf0b (windows-x64) node-v7.10.0
heroku-slugs 1.0.3

Proxy Support?

Is there any plans to honour a proxy? If we build out the proxy support, would you merge it in? 😄 👋 We need to run this behind a proxy, and it isn't working :(

Usage text doesn't mention archive extraction

It currently says:

$ heroku slugs:download --help
Usage: heroku slugs:download [SLUG_ID] [flags]

downloads a slug to slug.dump

Flags:
 -a, --app     (required) app to run command against
 -r, --remote  git remote of app to use

If SLUG_ID is not specified, returns the current slug.

It would be good to mention that it also extracts the archive too.

I'll fold this into the fix for #4.

Slug saved as .tar when it is a .tar.gz

The plugin downloads the slug to a file named slug.tar, however the file is actually a gzipped tar file (the original filename in the URL returned from the Heroku API is of form <SLUG_ID>.tar.gz).

This was using:
heroku-cli/6.11.17-91bdf0b (windows-x64) node-v7.10.0
heroku-slugs 1.0.3

cli-npm.heroku.com SSL Cert is invalid

The cert for cli-npm.heroku.com is invalid and is preventing installs.

Screen Shot 2020-07-16 at 12 35 10 PM

geopointe@Geopointes-MacBook-Pro l11-ui-kit % heroku plugins:install heroku-slugs
Installing heroku-slugs@latest... !
 ▸    yarn add heroku-slugs@latest --non-interactive --mutex=file:/Users/geopointe/.local/share/heroku/plugins/yarn.lock
 ▸    --preferred-cache-folder=/Users/geopointe/Library/Caches/heroku/yarn --registry=https://cli-npm.heroku.com exited with code 1
 ▸    error An unexpected error occurred: "https://cli-npm.heroku.com/heroku-slugs: Hostname/IP does not match certificate's altnames:
 ▸    Host: cli-npm.heroku.com. is not in the cert's altnames: DNS:*.herokuapp.com, DNS:herokuapp.com".
 ▸    
 ▸    yarn add v1.6.0
 ▸    info No lockfile found.
 ▸    [1/4] Resolving packages...
 ▸    info If you think this is a bug, please open a bug report with the information provided in
 ▸    "/Users/geopointe/.local/share/heroku/plugins/yarn-error.log".
 ▸    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Allow downloading a slug without extracting it

Currently running heroku slugs:download -a <APP_NAME> both downloads the slug and also extracts it.

It would be great to allow just downloading the slug on its own (and perhaps even make that the default).

So either:

heroku slugs:download -a <APP_NAME> --download-only

Or making only-downloading be the default, but offer optional extraction via:

heroku slugs:download -a <APP_NAME> --extract

Can't install with the error on Mac.

when install, following error was happened. What should I do to install ?

error An unexpected error occurred: "http://cli-npm.heroku.com/@oclif/config/-/config-1.6.33/61906143b30751d96dd29991c20c214bf4d9e4ff.tgz: Request failed "404 Not Found"".
Installing plugin heroku-slugs... !
Error: yarn add heroku-slugs@latest --non-interactive --mutex=file:/Users/XXXXXXXX/.local/share/heroku/yarn.lock --preferred-cache-folder=/Users/XXXXXXXX/Library/Caches/heroku/yarn --check-files --registry=https://registry.npmjs.org exited with code 1
at ChildProcess.forked.on (~/.local/share/heroku/client/7.12.2/node_modules/@oclif/plugin-plugins/lib/yarn.js:31:28)

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.