Skip to content

Commit

Permalink
Offline Porter Installation (#3210)
Browse files Browse the repository at this point in the history
* Simplified the bundle script

Signed-off-by: John Cudd <[email protected]>

* Added contributor

Signed-off-by: John Cudd <[email protected]>

* Updated docs

Signed-off-by: John Cudd <[email protected]>

* Removed trailing space

Signed-off-by: John Cudd <[email protected]>

* Added a note about mixins not being included

Signed-off-by: John Cudd <[email protected]>

* Tweaked the docs a bit

Signed-off-by: John Cudd <[email protected]>

* Added link at top

Signed-off-by: John Cudd <[email protected]>

* Add bundle script to release and netify redirects

Signed-off-by: John Cudd <[email protected]>

* Call host secrets plugin directly when resolving secrets (#3155)

We should not require all secret plugins to call the host secrets plugin
for non secret values. Instead we should call the host secrets plugin
directly.

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Add doc for AKS integration (#3206)

* add doc for AKS integration

Signed-off-by: dejanualex <[email protected]>

* remove merge action and outputs

Signed-off-by: dejanualex <[email protected]>

---------

Signed-off-by: dejanualex <[email protected]>
Co-authored-by: Kim Christensen <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Do not reference CNAB invocation images in documentation (#3200)

* Do not reference CNAB invocation images

As CNAB is an implementation detail as this point, we no longer want
to use the term 'invocation image'. Instead we should use the term
'bundle image'.
This PR ensures that the current references to 'invocation image' is
changed to 'bundle image'.

Signed-off-by: Kim Christensen <[email protected]>

---------

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Bump actions/download-artifact from 3.0.1 to 4.1.7 in /.github/workflows in the github_actions group across 1 directory (#3217)

Bump actions/download-artifact

Bumps the github_actions group with 1 update in the /.github/workflows directory: [actions/download-artifact](https://github.com/actions/download-artifact).

Updates `actions/download-artifact` from 3.0.1 to 4.1.7
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v3.0.1...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  dependency-group: github_actions
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: John Cudd <[email protected]>

* fix: Update version of upload-artifact (#3219)

fix: Update upload-artifact action version

Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Correct the Cosign links that have stopped working (#3220)

fix: Correct the Cosign links that have stopped working

Signed-off-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Upgrade should not be allowed if installation is not installed (#3213)

fix: Upgrade should not be allowed if installation is not installed

Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: John Cudd <[email protected]>

* Updated documentation to explain mongo

Also removed echo from the extraction instructions.

Signed-off-by: John Cudd <[email protected]>

---------

Signed-off-by: John Cudd <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: dejanualex <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kim Christensen <[email protected]>
Co-authored-by: schristoff <[email protected]>
Co-authored-by: dejanualex <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
5 people authored Sep 24, 2024
1 parent 7538008 commit 28abae5
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 6 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ and we will add you. **All** contributors belong here. 💯
- [guangwu guo](https://github.com/testwill)
- [Eric Herrmann](https://github.com/egherrmann)
- [Alex Dejanu](https://github.com/dejanu)
- [John Cudd](https://github.com/jmcudd)


24 changes: 24 additions & 0 deletions docs/content/docs/getting-started/install-porter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ aliases:
- [Install or Upgrade Porter](#install-or-upgrade)
- [Clean Install](#clean-install)
- [Install Latest Release](#latest)
- [Air-gapped Install](#air-gapped-install)
- [Install a Canary Build](#canary)
- [Install a Mixin](#mixins)
- [Install a Plugin](#plugins)
Expand Down Expand Up @@ -114,6 +115,29 @@ You will need to create a [PowerShell Profile][ps-link] if you do not have one.
iwr "https://cdn.porter.sh/latest/install-windows.ps1" -UseBasicParsing | iex
```

## Air-gapped Install

To run the installation script in an air-gapped environment, create an air-gapped installation package with the `bundle-linux.sh` script. Note that mixins are not currently included in the air-gapped-bundle.

```sh
curl -L https://raw.githubusercontent.com/getporter/porter/main/scripts/bundle/bundle-linux.sh | bash
```

Then extract and install Porter.

```sh
tar -xzf porter-air-gapped-install-latest.tar.gz -C .
cd porter-air-gapped-install-latest
bash install-bundle.sh
```

Note: The `install-bundle.sh` script starts mongo. If mongo ever has to be restarted use the following command.

```
docker run --name porter-mongodb-docker-plugin -d -p 27018:27017 -v mongodb_data:/data/db --restart always mongo:4.0-xenial
```


## Canary

Install the most recent build of Porter and the [exec mixin] from the main branch.
Expand Down
1 change: 1 addition & 0 deletions docs/static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/:version/install-linux.sh https://github.com/getporter/porter/releases/download/:version/install-linux.sh 200
/:version/install-mac.sh https://github.com/getporter/porter/releases/download/:version/install-mac.sh 200
/:version/install-windows.ps1 https://github.com/getporter/porter/releases/download/:version/install-windows.ps1 200
/:version/bundle-linux.sh https://github.com/getporter/porter/releases/download/:version/bundle-linux.sh 200

# Redirect the porter release artifacts
/:version/* https://github.com/getporter/porter/releases/download/:version/:splat 302
Expand Down
52 changes: 52 additions & 0 deletions scripts/bundle/bundle-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail

PORTER_MIRROR=${PORTER_MIRROR:-https://cdn.porter.sh}
PORTER_VERSION=${PORTER_VERSION:-latest}
MONGO_IMAGE_FILE="mongo_image.tar"
MONGO_IMAGE_URL="docker.io/library/mongo:4.0-xenial"
BUNDLE_NAME="porter-air-gapped-install-$PORTER_VERSION"
DOWNLOAD_DIR="/tmp/$BUNDLE_NAME"

PORTER_BINARY_URL=${PORTER_BINARY_URL:-"$PORTER_MIRROR/$PORTER_VERSION/porter-linux-amd64"}
PORTER_SCRIPT_URL=${PORTER_SCRIPT_URL:-"$PORTER_MIRROR/$PORTER_VERSION/install-linux.sh"}

mkdir -p $DOWNLOAD_DIR

echo "Pulling MongoDB image..."
docker pull "$MONGO_IMAGE_URL"
echo "Saving MongoDB image to $MONGO_IMAGE_FILE..."
docker save -o "$DOWNLOAD_DIR/$MONGO_IMAGE_FILE" "$MONGO_IMAGE_URL"

echo "Downloading Porter Install Script from $PORTER_SCRIPT_URL"
curl -fsSLo "$DOWNLOAD_DIR/install-linux.sh" "$PORTER_SCRIPT_URL"

echo "Downloading Porter Binary from $PORTER_BINARY_URL"
curl -fsSLo "$DOWNLOAD_DIR/porter-linux-amd64" "$PORTER_BINARY_URL"

cat << EOF > $DOWNLOAD_DIR/install-bundle.sh
export PORTER_BINARY_URL="file://\$(realpath ./porter-linux-amd64)"
export PORTER_SCRIPT_URL="file://\$(realpath ./install-linux.sh)"
bash install-linux.sh
docker load -i "$MONGO_IMAGE_FILE"
if ! docker ps -q -f name=porter-mongodb-docker-plugin; then
echo "Running MongoDB container..."
docker run --name porter-mongodb-docker-plugin -d -p 27018:27017 -v mongodb_data:/data/db --restart always mongo:4.0-xenial
else
echo "MongoDB container is already running."
fi
EOF


TAR_FILE="$BUNDLE_NAME.tar.gz"
echo "Creating tarball: $TAR_FILE..."
tar -czvf "$TAR_FILE" -C /tmp "$(basename "$DOWNLOAD_DIR")"

echo "Bundle created: $TAR_FILE"
echo "Usage Instructions:"
echo "tar -xzf $TAR_FILE -C ."
echo "cd $BUNDLE_NAME"
echo "bash install-bundle.sh"

exit 0

14 changes: 8 additions & 6 deletions scripts/install/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
set -euo pipefail

# Installs the porter CLI for a single user.
# PORTER_HOME: Location where Porter is installed (defaults to ~/.porter).
# PORTER_MIRROR: Base URL where Porter assets, such as binaries and atom feeds, are downloaded.
# This lets you setup an internal mirror.
# PORTER_VERSION: The version of Porter assets to download.
# PORTER_HOME: Location where Porter is installed (defaults to ~/.porter).
# PORTER_MIRROR: Base URL where Porter assets, such as binaries and atom feeds, are downloaded.
# This lets you setup an internal mirror.
# PORTER_VERSION: The version of Porter assets to download.
# PORTER_BINARY_URL: The URL to porter binary (https:// or file:// for local binary)

export PORTER_HOME=${PORTER_HOME:-~/.porter}
export PORTER_MIRROR=${PORTER_MIRROR:-https://cdn.porter.sh}
PORTER_VERSION=${PORTER_VERSION:-latest}
PORTER_BINARY_URL=${PORTER_BINARY_URL:-"$PORTER_MIRROR/$PORTER_VERSION/porter-linux-amd64"}

echo "Installing porter@$PORTER_VERSION to $PORTER_HOME from $PORTER_MIRROR"
echo "Installing porter@$PORTER_VERSION to $PORTER_HOME from $PORTER_BINARY_URL"

mkdir -p "$PORTER_HOME/runtimes"

curl -fsSLo "$PORTER_HOME/porter" "$PORTER_MIRROR/$PORTER_VERSION/porter-linux-amd64"
curl -fsSLo "$PORTER_HOME/porter" "$PORTER_BINARY_URL"
chmod +x "$PORTER_HOME/porter"
cp "$PORTER_HOME/porter" "$PORTER_HOME/runtimes/porter-runtime"
echo Installed "$("$PORTER_HOME"/porter version)"
Expand Down
1 change: 1 addition & 0 deletions scripts/prep-install-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ls -R bin
sed -e "s|PORTER_VERSION:-latest|PORTER_VERSION:-$VERSION|g" scripts/install/install-mac.sh > bin/$VERSION/install-mac.sh
sed -e "s|PORTER_VERSION:-latest|PORTER_VERSION:-$VERSION|g" scripts/install/install-linux.sh > bin/$VERSION/install-linux.sh
sed -e "s|PORTER_VERSION='latest'|PORTER_VERSION='$VERSION'|g" scripts/install/install-windows.ps1 > bin/$VERSION/install-windows.ps1
sed -e "s|PORTER_VERSION:-latest|PORTER_VERSION:-$VERSION|g" scripts/bundle/bundle-linux.sh > bin/$VERSION/bundle-linux.sh

0 comments on commit 28abae5

Please sign in to comment.