Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Registry Actions & Unable to encrypt connection: Unable to create server credentials Issue #22

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/registry-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,28 @@ jobs:
uses: docker/login-action@v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image (Edge & Latest Channel)
if: github.event.inputs.workflow_choice == 'edge' || github.event.inputs.workflow_choice == 'both' || github.event_name == 'push' || github.event_name == 'workflow_run'
env:
USERNAME: ${{ secrets.DOCKER_USERNAME }}
ORG: ${{ github.repository_owner }}
run: |
IMAGE="$(yq '.name' rockcraft.yaml)"
VERSION="$(yq '.version' rockcraft.yaml)"
ROCK="$(ls *.rock | tail -n 1)"
sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${USERNAME}/${IMAGE}:${VERSION}-edge"
ORG_NAME=$(echo "${ORG}" | tr '[:upper:]' '[:lower:]')
sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-edge"
# Push to Docker Hub
# docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${USERNAME}:${VERSION}-edge
# docker push ${USERNAME}/${IMAGE}:${VERSION}-edge
# docker tag ${USERNAME}/${IMAGE}:${VERSION}-edge ${USERNAME}/${IMAGE}:latest
# docker push ${USERNAME}/${IMAGE}:latest
# Push to GitHub Packages
GITHUB_IMAGE="ghcr.io/${{ github.repository_owner }}/${IMAGE}"
docker tag ${USERNAME}/${IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:${VERSION}-edge
GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}"
docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:${VERSION}-edge
docker push ${GITHUB_IMAGE}:${VERSION}-edge
docker tag ${GITHUB_IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:latest
docker push ${GITHUB_IMAGE}:latest
Expand All @@ -100,14 +103,17 @@ jobs:
if: github.event.inputs.workflow_choice == 'stable' || github.event.inputs.workflow_choice == 'both'
env:
USERNAME: ${{ secrets.DOCKER_USERNAME }}
ORG: ${{ github.repository_owner }}
run: |
IMAGE="$(yq '.name' rockcraft.yaml)"
VERSION="$(yq '.version' rockcraft.yaml)"
ROCK="$(ls *.rock | tail -n 1)"
sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${USERNAME}/${IMAGE}:${VERSION}-stable"
ORG_NAME=$(echo "${ORG}" | tr '[:upper:]' '[:lower:]')
sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-stable"
# Push to Docker Hub
# docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-stable ${USERNAME}:${VERSION}-stable
# docker push ${USERNAME}/${IMAGE}:${VERSION}-stable
# Push to GitHub Packages
GITHUB_IMAGE="ghcr.io/${{ github.repository_owner }}/${IMAGE}"
docker tag ${USERNAME}/${IMAGE}:${VERSION}-stable ${GITHUB_IMAGE}:${VERSION}-stable
GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}"
docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-stable ${GITHUB_IMAGE}:${VERSION}-stable
docker push ${GITHUB_IMAGE}:${VERSION}-stable
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,38 @@ file for configuring SNMP network printer discovery.

#### Step-by-Step Guide

The first step is to pull the hplip-printer-app Docker image from Docker Hub.
You can pull the `hplip-printer-app` Docker image from either the GitHub Container Registry or Docker Hub.

**From GitHub Container Registry** <br>
To pull the image from the GitHub Container Registry, run the following command:
```sh
sudo docker pull ghcr.io/openprinting/hplip-printer-app:latest
```

To run the container after pulling the image from the GitHub Container Registry, use:
```sh
sudo docker run -d \
--name hplip-printer-app \
--network host \
-e PORT=<port> \
ghcr.io/openprinting/hplip-printer-app:latest
```

**From Docker Hub** <br>
Alternatively, you can pull the image from Docker Hub, by running:
```sh
sudo docker pull openprinting/hplip-printer-app
```

Run the following Docker command to run the hplip-printer-app image:
To run the container after pulling the image from Docker Hub, use:
```sh
sudo docker run --rm -d \
sudo docker run -d \
--name hplip-printer-app \
--network host \
-e PORT=<port> \
openprinting/hplip-printer-app:latest
```

- `PORT` is an optional environment variable used to start the printer-app on a specified port. If not provided, it will start on the default port 8000 or, if port 8000 is busy, on 8001 and so on.
- **The container must be started in `--network host` mode** to allow the Printer-Application instance inside the container to access and discover printers available in the local network where the host system is in.
- Alternatively using the internal network of the Docker instance (`-p <port>:8000` instead of `--network host -e PORT=<port>`) only gives access to local printers running on the host system itself.
Expand Down Expand Up @@ -314,7 +333,7 @@ Once the rock is built, you need to compile docker image from it.
**Run the hplip-printer-app Docker Container**

```sh
sudo docker run --rm -d \
sudo docker run -d \
--name hplip-printer-app \
--network host \
-e PORT=<port> \
Expand Down
23 changes: 23 additions & 0 deletions scripts/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,27 @@ if [ -n "${PORT:-}" ]; then
fi
fi

# Ensure the /etc/cups/ssl directory exists with proper permissions
CUPS_SERVERROOT="/etc/cups/ssl"
if [ ! -d "$CUPS_SERVERROOT" ]; then
mkdir -p "$CUPS_SERVERROOT"
fi
chmod 755 "$CUPS_SERVERROOT"

# Ensure /var/lib/hplip-printer-app directory exists
STATE_DIR="/var/lib/hplip-printer-app"

if [ ! -d "$STATE_DIR" ]; then
mkdir -p "$STATE_DIR"
fi
chmod 755 "$STATE_DIR"

# Ensure hplip-printer-app.state file exists
STATE_FILE="$STATE_DIR/hplip-printer-app.state"
if [ ! -f "$STATE_FILE" ]; then
touch "$STATE_FILE"
fi
chmod 755 "$STATE_FILE"

# Start the hplip-printer-app server
hplip-printer-app -o log-file=/hplip-printer-app.log ${PORT:+-o server-port=$PORT} server
Loading