Skip to content

Commit

Permalink
chore: merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala authored and birme committed Sep 11, 2024
1 parent f48a9ff commit d27e065
Show file tree
Hide file tree
Showing 88 changed files with 2,009 additions and 871 deletions.
13 changes: 8 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# MongoDB
MONGODB_URI=${MONGODB_URI:-mongodb://api:password@localhost:27017/agile-live-gui}
MONGODB_URI=${MONGODB_URI:-mongodb://api:password@localhost:27017/live-gui}

# AgileLive System Controlleer
AGILE_URL=${AGILE_URL:-https://localhost:8080}
AGILE_CREDENTIALS=${AGILE_CREDENTIALS:-admin:admin}
# This ENV variable disables SSL Verification, the above AGILE_URL doesn't have a proper certificate
# Ateliere Live System Controlleer
LIVE_URL=${LIVE_URL:-https://localhost:8080}
LIVE_CREDENTIALS=${LIVE_CREDENTIALS:-admin:admin}
# This ENV variable disables SSL Verification, use if the above LIVE_URL doesn't have a proper certificate
NODE_TLS_REJECT_UNAUTHORIZED=${NODE_TLS_REJECT_UNAUTHORIZED:-1}

# NextAuth
Expand All @@ -14,3 +14,6 @@ BCRYPT_SALT_ROUNDS=${BCRYPT_SALT_ROUNDS:-10}

# i18n
UI_LANG=${UI_LANG:-en}

# Mediaplayer - path on the system controller
MEDIAPLAYER_PLACEHOLDER=/media/media_placeholder.mp4
59 changes: 59 additions & 0 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Trigger build of Docker image

on: workflow_dispatch

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build and push Docker image
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: type=sha

- name: Extract GUI version
id: gui
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: echo "::set-output name=version::${TAGS##*:}"

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
GUI_VERSION=${{ steps.gui.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and push Docker image when a release is published

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build and push Docker image
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Extract GUI version
id: gui
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: echo "::set-output name=version::${TAGS##*:}"

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
GUI_VERSION=${{ steps.gui.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@ RUN \

# Rebuild the source code only when needed
FROM base AS builder
ARG GUI_VERSION=dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1

RUN echo ${GUI_VERSION} > /app/gui-version.txt
RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
Expand All @@ -46,13 +48,11 @@ COPY --from=builder /app/public ./public
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

COPY gui-version.txt ./

COPY --from=builder /app/gui-version.txt ./
USER nextjs

EXPOSE 3000

ENV PORT 3000
ENV PORT=3000

CMD ["node", "server.js"]
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Start mongodb docker container using `docker-compose up`. It will initialize the
If you want to run the GUI and mongodb docker containers add this to the `docker-compose.yml` file:

```
agileui:
liveui:
build: .
environment:
MONGODB_URI: mongodb://api:<API_PASSWORD>@host.docker.internal:27017/agile-live-gui
AGILE_URL: https://<SYSTEM_CONTROLLER_IP>:8080
AGILE_CREDENTIALS: <USERNAME>:<PASSWORD>
MONGODB_URI: mongodb://api:<API_PASSWORD>@host.docker.internal:27017/live-gui
LIVE_URL: https://<SYSTEM_CONTROLLER_IP>:8080
LIVE_CREDENTIALS: <USERNAME>:<PASSWORD>
NODE_TLS_REJECT_UNAUTHORIZED: 0
NEXTAUTH_SECRET: <NEXT_AUTH_SECRET>
NEXTAUTH_URL: http://localhost:3000
Expand All @@ -34,10 +34,10 @@ If you want to run the GUI and mongodb docker containers add this to the `docker

Then copy the `.env.sample` file and name it `.env`, it will contain env variables:

- `MONGODB_URI` - The mongodb connection string including credentials eg. `mongodb://user123:pass123@127.0.0.1:27017/agile-live-gui`
- `MONGODB_URI` - The mongodb connection string including credentials eg. `mongodb://user123:pass123@127.0.0.1:27017/live-gui`

- `AGILE_URL` - The URL to the Agile-live system controller REST API
- `AGILE_CREDENTIALS` - Credentials for the Agile-live system controller REST API
- `LIVE_URL` - The URL to the Ateliere Live system controller REST API
- `LIVE_CREDENTIALS` - Credentials for the Ateliere Live system controller REST API

- `NEXTAUTH_SECRET` - The secret used to encrypt the JWT Token
- `NEXTAUTH_URL` - The base url for the service, eg. `http://localhost:3000`, used internally by NextAuth.
Expand All @@ -64,7 +64,7 @@ Run following to run application in development environment:

### External Documentation

https://docs.agilecontent.com/docs/acl/reference/3-0-0/rest_api/
https://help.ateliere.com/live/docs/reference/7-0-0/rest_api/

### Contributing

Expand Down
23 changes: 23 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
To build and publish a release of the official Docker image, in this example patch version `v1.0.1`:

1. Create a tag with name `v1.0.1`

```
% git tag v1.0.1
```

2. Push the tag to GitHub remote

```
% git push --tags
```

3. Open browser and navigate to the repository on GitHub. Go to the Releases section by clicking on the Releases header on the right side of the page.

4. Click on Create a new release and choose the tag `v1.0.1` that you created.

5. Describe the release by adding release notes in the markdown input field.

6. Click on Publish release.

This will trigger a GitHub action that will build Docker image and tag it with `v1.0.1` and push to container registry.
2 changes: 1 addition & 1 deletion docs/production_workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Terminology

- System referes to the agile live backend
- System refers to the ateliere live backend
- Manager refers to this application.

## Assumptions
Expand Down
Loading

0 comments on commit d27e065

Please sign in to comment.