-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ahti Nurminen
committed
Apr 24, 2018
1 parent
2c513f8
commit 77d66b2
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Heroku buildpack: curl with sftp (libssh2) support | ||
================================================== | ||
|
||
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) that replaces the Ubuntu default `curl` and `libcurl` with a latest compiled version including ssl and libssh2 packages. | ||
Purpose for this addition is to enable using sftp with curl from PHP application via autheticating Proxy like QuotaGuard or Fixie. | ||
|
||
Usage | ||
----- | ||
|
||
See Heroku's documentation on [multiple buildpacks](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app). | ||
|
||
Example usage for a PHP app: | ||
|
||
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php.git | ||
$ heroku buildpacks:add https://github.com/frcade/heroku-buildpack-curl-libssh2.git --index 1 | ||
$ git push heroku master | ||
... | ||
|
||
You can verify the installation using the following command: | ||
|
||
$ heroku run "curl --version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
# bin/compile <build-dir> <cache-dir> <env-dir> | ||
|
||
### Configure environment | ||
|
||
set -o errexit # always exit on error | ||
set -o pipefail # don't ignore exit codes when piping output | ||
unset GIT_DIR # Avoid GIT_DIR leak from previous build steps | ||
|
||
### Formatting utilities | ||
|
||
indent() { | ||
sed -u 's/^/ /' | ||
} | ||
|
||
### Constants | ||
|
||
CURL_VERSION=7.58.0 | ||
|
||
### Configure directories | ||
|
||
BUILD_DIR=${1:-} | ||
CACHE_DIR=${2:-} | ||
ENV_DIR=${3:-} | ||
BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) | ||
|
||
### Download, make and install | ||
|
||
echo "-----> Downloading curl $CURL_VERSION" | ||
DOWNLOAD_URL="http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_$CURL_VERSION.orig.tar.gz" | ||
curl -sL "$DOWNLOAD_URL" > curl_$CURL_VERSION.orig.tar.gz 2>&1 | indent | ||
tar -xf curl_$CURL_VERSION.orig.tar.gz | ||
pushd curl-$CURL_VERSION | ||
echo "-----> Configuring curl with ssl and libssh2" | ||
./configure --prefix=$BUILD_DIR/vendor --with-ssl --with-libssh2 2>&1 | indent | ||
echo "-----> Building curl" | ||
make 2>&1 | indent | ||
echo "-----> Installing curl" | ||
make install 2>&1 | indent | ||
popd | ||
|
||
echo "-----> Setting up environment" | ||
mkdir -p $BUILD_DIR/.profile.d | ||
cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
# this pack is valid for all apps | ||
echo "curl" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
echo "--- {}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
export PATH=$HOME/vendor/bin:$PATH | ||
export LD_LIBRARY_PATH=$HOME/vendor/lib:$LD_LIBRARY_PATH |