Skip to content

Commit

Permalink
feat: rename the tool from copepod to pipe
Browse files Browse the repository at this point in the history
Because the docker image is piped through ssh and loaded to the docker instance
  • Loading branch information
bjarneo committed Nov 28, 2024
1 parent 90eb326 commit 0819829
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ jobs:
GOARCH: ${{ matrix.goarch }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
go build -v -ldflags="-X main.version=${VERSION}" -o copepod-${{ matrix.os }}-${{ matrix.arch }}
chmod +x copepod-${{ matrix.os }}-${{ matrix.arch }}
go build -v -ldflags="-X main.version=${VERSION}" -o pipe-${{ matrix.os }}-${{ matrix.arch }}
chmod +x pipe-${{ matrix.os }}-${{ matrix.arch }}
- name: Generate SHA-256
run: |
sha256sum copepod-${{ matrix.os }}-${{ matrix.arch }} > copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
sha256sum pipe-${{ matrix.os }}-${{ matrix.arch }} > pipe-${{ matrix.os }}-${{ matrix.arch }}.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
path: |
copepod-${{ matrix.os }}-${{ matrix.arch }}
copepod-${{ matrix.os }}-${{ matrix.arch }}.sha256
pipe-${{ matrix.os }}-${{ matrix.arch }}
pipe-${{ matrix.os }}-${{ matrix.arch }}.sha256
retention-days: 1
release:
name: Create Release
Expand Down Expand Up @@ -88,4 +88,4 @@ jobs:
--repo "$GITHUB_REPOSITORY" \
--title "Copepod $VERSION" \
--notes-file release_notes.md \
copepod-*
pipe-*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Binary
copepod-*
pipe-*

# Build
build/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM nginx:alpine
RUN echo '<!DOCTYPE html>\
<html>\
<head>\
<title>Welcome to copepod3</title>\
<title>Welcome to pipe3</title>\
</head>\
<body>\
<div class="container">\
Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,34 @@ A simple yet powerful Go-based CLI tool for automating Docker container deployme

### Pre-built Binaries

Download the latest pre-built binary from the [releases page](https://github.com/bjarneo/copepod/releases).
Download the latest pre-built binary from the [releases page](https://github.com/bjarneo/pipe/releases).

Available binaries:

- Linux (AMD64): `copepod-linux-amd64`
- Linux (ARM64): `copepod-linux-arm64`
- macOS (Intel): `copepod-darwin-amd64`
- macOS (Apple Silicon): `copepod-darwin-arm64`
- Linux (AMD64): `pipe-linux-amd64`
- Linux (ARM64): `pipe-linux-arm64`
- macOS (Intel): `pipe-darwin-amd64`
- macOS (Apple Silicon): `pipe-darwin-arm64`

After downloading:

1. Verify the checksum (SHA-256):

```bash
sha256sum -c copepod-<os>-<arch>.sha256
sha256sum -c pipe-<os>-<arch>.sha256
```

2. Make the binary executable:

```bash
chmod +x copepod-<os>-<arch>
chmod +x pipe-<os>-<arch>
```

3. Optionally, move to your PATH:

```bash
# Example for Linux/macOS
sudo mv copepod-<os>-<arch> /usr/local/bin/copepod
sudo mv pipe-<os>-<arch> /usr/local/bin/pipe
```

### Building from Source
Expand All @@ -56,14 +56,14 @@ Requirements:

```bash
git clone <repository-url>
cd copepod
go build -o copepod
cd pipe
go build -o pipe
```

## Usage

```bash
./copepod [options]
./pipe [options]
```

### Command Line Options
Expand All @@ -72,11 +72,11 @@ go build -o copepod
|-----------------|----------------------------|------------------|----------------------------------|
| --host | HOST | | Remote host to deploy to |
| --user | HOST_USER | | SSH user for remote host |
| --image | DOCKER_IMAGE_NAME | copepod_app | Docker image name |
| --image | DOCKER_IMAGE_NAME | pipe_app | Docker image name |
| --tag | DOCKER_IMAGE_TAG | latest | Docker image tag |
| --platform | HOST_PLATFORM | linux/amd64 | Docker platform |
| --ssh-key | SSH_KEY_PATH | | Path to SSH key |
| --container-name| DOCKER_CONTAINER_NAME | copepod_app | Name for the container |
| --container-name| DOCKER_CONTAINER_NAME | pipe_app | Name for the container |
| --container-port| DOCKER_CONTAINER_PORT | 3000 | Container port |
| --host-port | HOST_PORT | 3000 | Host port |
| --env-file | DOCKER_CONTAINER_ENV_FILE | | Environment file |
Expand All @@ -93,19 +93,19 @@ go build -o copepod
Basic deployment:

```bash
./copepod --host example.com --user deploy
./pipe --host example.com --user deploy
```

Deployment with custom ports:

```bash
./copepod --host example.com --user deploy --container-name myapp --container-port 8080 --host-port 80
./pipe --host example.com --user deploy --container-name myapp --container-port 8080 --host-port 80
```

Using environment file:

```bash
./copepod --env-file .env.production
./pipe --env-file .env.production
```

Rollback:
Expand All @@ -119,20 +119,20 @@ Using build arguments:

```bash
# Single build argument
./copepod --host example.com --user deploy --build-arg VERSION=1.0.0
./pipe --host example.com --user deploy --build-arg VERSION=1.0.0

# Multiple build arguments
./copepod --host example.com --user deploy --build-arg VERSION=1.0.0 --build-arg ENV=prod
./pipe --host example.com --user deploy --build-arg VERSION=1.0.0 --build-arg ENV=prod

# Using environment variable
# Using git commit hash
./copepod --host example.com --user deploy --build-arg GIT_HASH=$(git rev-parse HEAD)
./pipe --host example.com --user deploy --build-arg GIT_HASH=$(git rev-parse HEAD)
```

Advanced deployment with resource limits and volumes:

```bash
./copepod --host example.com --user deploy \
./pipe --host example.com --user deploy \
--network my-network \
--volume /host/data:/container/data \
--volume /host/config:/container/config \
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Deploy to production
uses: bjarneo/copepod@main
uses: bjarneo/pipe@main
with:
host: remote_host.com
user: deploy_user
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
# Example of rolling back if needed
# NOTE: You want to have a manual approval step in between to ensure you want to rollback
- name: Rollback production
uses: bjarneo/copepod@main
uses: bjarneo/pipe@main
with:
host: remote_host.com
user: deploy_user
Expand All @@ -243,10 +243,10 @@ When using Copepod as a GitHub Action, the following inputs are available:
| host | Yes | | Remote host to deploy to |
| user | Yes | | SSH user for remote host |
| ssh_key | Yes | | SSH private key for authentication |
| image | No | copepod_app | Docker image name |
| image | No | pipe_app | Docker image name |
| tag | No | latest | Docker image tag |
| platform | No | linux/amd64 | Docker platform |
| container_name | No | copepod_app | Name for the container |
| container_name | No | pipe_app | Name for the container |
| container_port | No | 3000 | Container port |
| host_port | No | 3000 | Host port |
| env_file | No | | Path to environment file |
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ runs:
- name: Download Copepod
shell: bash
run: |
curl -L -o copepod "https://github.com/bjarneo/copepod/releases/latest/download/copepod-linux-amd64"
chmod +x copepod
curl -L -o pipe "https://github.com/bjarneo/pipe/releases/latest/download/pipe-linux-amd64"
chmod +x pipe
- name: Prepare build args
id: build_args
Expand Down Expand Up @@ -121,9 +121,9 @@ runs:
SSH_KEY_PATH: ~/.ssh/deploy_key
run: |
if [ "${{ inputs.rollback }}" = "true" ]; then
./copepod --rollback
./pipe --rollback
else
./copepod ${{ steps.build_args.outputs.args }} ${{ steps.volume_flags.outputs.flags }}
./pipe ${{ steps.build_args.outputs.args }} ${{ steps.volume_flags.outputs.flags }}
fi
- name: Upload deployment logs
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/bjarneo/copepod
module github.com/bjarneo/pipe

go 1.21
12 changes: 6 additions & 6 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const helpText = `
Docker Deployment Tool
Usage:
copepod [options]
pipe [options]
Options:
--host Remote host to deploy to
Expand Down Expand Up @@ -188,9 +188,9 @@ Environment Variables:
Examples:
copepod --host example.com --user deploy
copepod --host example.com --user deploy --build-arg VERSION=1.0.0 --build-arg ENV=prod
copepod --env-file .env.production --build-arg GIT_HASH=$(git rev-parse HEAD)
copepod --host example.com --user deploy --cpus "0.5" --memory "512m"
copepod --rollback # Rollback to the previous version
pipe --host example.com --user deploy
pipe --host example.com --user deploy --build-arg VERSION=1.0.0 --build-arg ENV=prod
pipe --env-file .env.production --build-arg GIT_HASH=$(git rev-parse HEAD)
pipe --host example.com --user deploy --cpus "0.5" --memory "512m"
pipe --rollback # Rollback to the previous version
`
8 changes: 4 additions & 4 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"strings"

"github.com/bjarneo/copepod/internal/config"
"github.com/bjarneo/copepod/internal/docker"
"github.com/bjarneo/copepod/internal/logger"
"github.com/bjarneo/copepod/internal/ssh"
"github.com/bjarneo/pipe/internal/config"
"github.com/bjarneo/pipe/internal/docker"
"github.com/bjarneo/pipe/internal/logger"
"github.com/bjarneo/pipe/internal/ssh"
)

// Deploy performs the main deployment process
Expand Down
6 changes: 3 additions & 3 deletions internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"strings"

"github.com/bjarneo/copepod/internal/config"
"github.com/bjarneo/copepod/internal/logger"
"github.com/bjarneo/copepod/internal/ssh"
"github.com/bjarneo/pipe/internal/config"
"github.com/bjarneo/pipe/internal/logger"
"github.com/bjarneo/pipe/internal/ssh"
)

// Check checks if Docker is installed and running locally and remotely
Expand Down
4 changes: 2 additions & 2 deletions internal/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os/exec"
"strings"

"github.com/bjarneo/copepod/internal/config"
"github.com/bjarneo/copepod/internal/logger"
"github.com/bjarneo/pipe/internal/config"
"github.com/bjarneo/pipe/internal/logger"
)

// CommandResult contains the output of a command
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"os"

"github.com/bjarneo/copepod/internal/config"
"github.com/bjarneo/copepod/internal/deploy"
"github.com/bjarneo/copepod/internal/logger"
"github.com/bjarneo/pipe/internal/config"
"github.com/bjarneo/pipe/internal/deploy"
"github.com/bjarneo/pipe/internal/logger"
)

func main() {
Expand Down

0 comments on commit 0819829

Please sign in to comment.