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

Add podman support #327

Draft
wants to merge 37 commits into
base: v1.5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8a20ac0
Image version 1.4.1
mrsabath Aug 8, 2023
67fc9c9
Bump actions/setup-go from 4.0.1 to 4.1.0 (#296)
dependabot[bot] Aug 15, 2023
483cff3
Bump golangci/golangci-lint-action from 3.6.0 to 3.7.0 (#297)
dependabot[bot] Aug 15, 2023
84aaafc
Bump actions/setup-node from 3.7.0 to 3.8.0 (#298)
dependabot[bot] Aug 16, 2023
05ff6b0
Bump actions/checkout from 3.5.3 to 3.6.0 (#300)
dependabot[bot] Aug 29, 2023
231a93b
Bump actions/setup-node from 3.8.0 to 3.8.1 (#299)
dependabot[bot] Sep 8, 2023
ceec845
Introduce Docker files for running Tornjak on Openshift (#304)
mrsabath Sep 21, 2023
bb3d0d4
Bump actions/checkout from 3.6.0 to 4.0.0 (#301)
dependabot[bot] Sep 22, 2023
0ee836e
Bump docker/login-action from 2.2.0 to 3.0.0 (#302)
dependabot[bot] Sep 25, 2023
a5420d4
Bump actions/checkout from 4.0.0 to 4.1.0 (#305)
dependabot[bot] Sep 25, 2023
fbd2176
Added workflows for ubi image (#306)
maia-iyer Sep 25, 2023
1688763
workflow hotfix
maia-iyer Sep 25, 2023
1f28fc4
Fixed workflow to set proper environment variable (#307)
mrsabath Sep 26, 2023
b7d9a5b
Fixed image labels for UBI image (#308)
maia-iyer Sep 28, 2023
8e8070f
Bump golang.org/x/net from 0.9.0 to 0.17.0 (#309)
dependabot[bot] Oct 12, 2023
d23b00b
Add UBI description (#310)
maia-iyer Oct 12, 2023
7e87ea1
Change version to v1.4.2
maia-iyer Oct 12, 2023
0addf3a
Change version to v1.4.2 (#311)
mrsabath Oct 12, 2023
a89ee87
Bump actions/checkout from 4.1.0 to 4.1.1 (#312)
dependabot[bot] Oct 18, 2023
ac847f5
Bump @babel/traverse from 7.22.5 to 7.23.2 in /tornjak-frontend (#313)
dependabot[bot] Oct 20, 2023
3188d03
Bump actions/setup-node from 3.8.1 to 4.0.0 (#314)
dependabot[bot] Oct 24, 2023
e32d3a5
Bump google.golang.org/grpc from 1.55.0 to 1.56.3 (#316)
dependabot[bot] Oct 26, 2023
e093c99
add support for nextjs (#317)
mamy-CS Nov 2, 2023
1817e82
Reorganize Root Directory (#315)
maia-iyer Nov 3, 2023
b763e6a
Bump github.com/go-jose/go-jose/v3 from 3.0.0 to 3.0.1 (#320)
dependabot[bot] Nov 22, 2023
1e0d43c
Update Quickstart Readme (#318)
kidus0214 Nov 27, 2023
3423a91
Bump @adobe/css-tools from 4.3.1 to 4.3.2 in /frontend (#321)
dependabot[bot] Dec 3, 2023
c6692da
Bump actions/setup-go from 4.1.0 to 5.0.0 (#322)
dependabot[bot] Dec 7, 2023
a3e1882
Fix type for upgraded Axios library (#323)
maia-iyer Dec 13, 2023
3d89c2a
Bump axios from 0.21.4 to 1.6.0 in /frontend (#319)
dependabot[bot] Dec 13, 2023
f43effe
Update version.txt
maia-iyer Dec 13, 2023
41c6f0d
Update Push Action Branch to v1.5 (#324)
maia-iyer Dec 13, 2023
03c1adc
Add podman support
mrsabath Dec 19, 2023
d90a086
Merge branch 'v1.5' into podman
mrsabath Dec 19, 2023
06a03af
Update Makefile
mrsabath Dec 20, 2023
fff71de
Update Makefile
mrsabath Dec 20, 2023
592059d
Add support for Podman env.
mrsabath Dec 21, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ jobs:
EOF

- name: Check out repository code
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.1

- name: Install Golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5.0.0
with:
go-version-file: go.mod
check-latest: true
cache: true

- uses: actions/setup-node@v3.7.0
- uses: actions/setup-node@v4.0.0
with:
node-version: '18'

- name: Download modules
run: go mod download

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.53
args: --timeout 7m
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/master-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
- v1.4
- v1.5
jobs:
tornjak-build:
runs-on: ubuntu-latest
Expand All @@ -19,10 +19,10 @@ jobs:
EOF

- name: Check out repository code
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.1

- name: Install Golang
uses: actions/setup-go@v4.0.1
uses: actions/setup-go@v5.0.0
with:
go-version-file: go.mod
check-latest: true
Expand All @@ -31,21 +31,21 @@ jobs:
- name: Download modules
run: go mod download

- uses: actions/setup-node@v3.7.0
- uses: actions/setup-node@v4.0.0
with:
node-version: '18'

- name: Download modules
run: go mod download

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.53
args: --timeout 7m

- name: Log in to GHCR.io
uses: docker/login-action@v2.2.0
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -59,17 +59,19 @@ jobs:
run: echo "REPO=ghcr.io/${{ github.repository_owner }}" >> $GITHUB_ENV

# build and push images tagged with GITHUB_SHA, version, and latest
- name: Build and push tornjak backend image
run: make release-tornjak-backend
- name: Build and push tornjak images
run: make release-images

- name: Build and push tornjak frontend image
run: make release-tornjak-frontend
# build and push UBI images
- name: Add ubi prefix
run: echo "IMAGE_TAG_PREFIX=ubi-" >> $GITHUB_ENV
- name: Set frontend Dockerfile
run: echo "DOCKERFILE_FRONTEND=frontend/Dockerfile.frontend-container.ubi" >> $GITHUB_ENV
- name: Set backend Dockerfile
run: echo "DOCKERFILE_BACKEND=Dockerfile.backend-container.ubi" >> $GITHUB_ENV

- name: Build and push tornjak image (frontend+backend)
run: make release-tornjak

- name: Build and push tornjak manager image
run: make release-tornjak-manager
- name: Build and push UBI images
run: make release-images

- name: Print job result
run: |
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
vendor

# dependencies
tornjak-frontend/node_modules
tornjak-frontend/.pnp
tornjak-frontend/.pnp.js
frontend/node_modules
frontend/.pnp
frontend/.pnp.js

# testing
tornjak-frontend/coverage
frontend/coverage

# production
tornjak-frontend/build
frontend/build

# misc
.DS_Store
Expand Down
33 changes: 25 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,49 @@ Otherwise, you can follow instructions below to build Tornjak images.
## Build Requirements

In order to build, we require the following installations:
- [Docker](https://docs.docker.com/engine/install/) for the backend build

- [docker](https://docs.docker.com/engine/install/) or [podman](https://podman.io/) for the backend build
- [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for the frontend build if running locally
- [Golang](https://go.dev/doc/install) is required if you would like to run the Go backends locally

## Building Executables and Images

When using `podman` please extend the default resources in order to successfully build
Tornjak images.

```console
podman machine init
podman machine set --cpus 4 --memory 4096
podman machine start
```

Building Tornjak manually can be done with the Makefile. Notable make targets follow:

- `make bin/tornjak-backend`: makes the Go executable of the Tornjak backend
- `make bin/tornjak-manager`: makes the Go executable of the Tornjak manager
- `make frontend-local-build`: makes the optimized ReactJS app locally for the Tornjak frontend. Uses environment variable configuration as in tornjak-frontend/.env
- `make image-tornjak-backend`: containerizes Go executable of the Tornjak backend
- `make image-tornjak-manager`:containerizes Go executable of the Tornjak manager
- `make image-tornjak-frontend`: containerizes React JS app for the Tornjak frontend
- `make image-tornjak`: containerizes Tornjak backend with Tornjak frontend
- `make image-tornjak-backend`: builds image for the Tornjak backend
- `make image-tornjak-manager`: builds image for the Tornjak manager
- `make image-tornjak-frontend`: builds image for the Tornjak frontend
- `make images`: builds all the above images
- `make compose-frontend`: runs the Tornjak frontend using Docker or Podman compose
- `make release-tornjak-backend`: publish the Tornjak backend image
- `make release-tornjak-frontend`: publish the Tornjak frontend image
- `make release-tornjak-manager`: publish the Tornjak manager image
- `make release-images`: publish all the above images

For usage instructions of the containers, please see our [USAGE document](./USAGE.md) to get started.

## Development

We welcome all development attempst and contributions from the community. The easiest place to start is by reviewing our code architecture diagrams available in our [api documentation](./docs/tornjak-ui-api-documentation.md#11-overview).
We welcome all development attempts and contributions from the community. The easiest place to start is by reviewing our code architecture diagrams available in our [api documentation](./docs/tornjak-ui-api-documentation.md#11-overview).

## Local testing

We highly recommend starting with our [quickstart tutorial](docs/quickstart/README.md), using official images and preset configs before development. This tutorial creates a local instance of SPIRE on Minikube, adds Tornjak server, and runs a UI.

Additionally, one may test out several other features including the following:

- [Running the Frontend Locally](#running-the-frontend-locally)
- [Running the Backend Locally](#running-the-backend-locally)
- [Running the Tornjak Manager Locally](#running-the-tornjak-manager)
Expand Down Expand Up @@ -79,15 +96,15 @@ Note, the above command will print out usage documentation for the server. Pleas

You may run the uncontainerized Tornjak manager by locally running the following:

```
```console
go run tornjak-backend/cmd/manager/manager.go
```

which starts listening on port 50000.

To start the manager UI, run:

```
```console
REACT_APP_API_SERVER_URI=http://localhost:50000/
REACT_APP_TORNJAK_MANAGER=true npm start
```
Expand Down
23 changes: 20 additions & 3 deletions Dockerfile.backend-container
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,32 @@ WORKDIR /opt/spire
ENTRYPOINT ["/opt/spire/run_backend.sh"]

# Add init
COPY run_backend.sh run_backend.sh
COPY scripts/run_backend.sh run_backend.sh
COPY bin/tornjak-backend tornjak-backend

# add a version link to the image description
ARG version
ARG github_sha
LABEL org.opencontainers.image.description="Tornjak backend ($version): https://github.com/spiffe/tornjak/releases/tag/$version" \
LABEL org.opencontainers.image.description="Tornjak backend ($version) Alpine based image: https://github.com/spiffe/tornjak/releases/tag/$version" \
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"

# Additional labels
LABEL architecture="amd64" \
build-date="" \
description="Tornjak Backend" \
io.k8s.description="Tornjak Backend" \
io.k8s.display-name="tornjak-backend" \
maintainer="" \
name="spiffe/tornjak-backend" \
release="$version" \
summary="Tornjak backend image" \
url="" \
vcs-ref="" \
vcs-type="" \
vendor="" \
version="$version"

# create env. variables with the build details
ENV VERSION=$version
ENV GITHUB_SHA=$github_sha
35 changes: 35 additions & 0 deletions Dockerfile.backend-container.ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM registry.access.redhat.com/ubi8-micro:latest
RUN mkdir -p /opt/spire

WORKDIR /opt/spire
ENTRYPOINT ["/opt/spire/run_backend.sh"]

# Add init
COPY scripts/run_backend.sh run_backend.sh
COPY bin/tornjak-backend tornjak-backend

# add a version link to the image description
ARG version
ARG github_sha
LABEL org.opencontainers.image.description="Tornjak backend ($version) UBI based image: https://github.com/spiffe/tornjak/releases/tag/$version" \
org.opencontainers.image.source="https://github.com/spiffe/tornjak" \
org.opencontainers.image.documentation="https://github.com/spiffe/tornjak/tree/main/docs"
# replace UBI labels
LABEL architecture="amd64" \
build-date="" \
description="Tornjak Backend" \
io.k8s.description="Tornjak Backend" \
io.k8s.display-name="tornjak-backend" \
maintainer="" \
name="spiffe/tornjak-backend" \
release="$version" \
summary="Tornjak backend UBI image" \
url="" \
vcs-ref="" \
vcs-type="" \
vendor="" \
version="$version"

# create env. variables with the build details
ENV VERSION=$version
ENV GITHUB_SHA=$github_sha
35 changes: 0 additions & 35 deletions Dockerfile.tornjak-container

This file was deleted.

Loading
Loading