Skip to content

Commit

Permalink
Merge 'main' into support-versioned-urls
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnimarun committed Nov 2, 2023
2 parents abbe876 + 38559bf commit 4d16814
Show file tree
Hide file tree
Showing 53 changed files with 822 additions and 530 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/on-pull-req.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ on:
pull_request:
branches: [main]
jobs:
prettier:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
# ubuntu-latest provides node & rust installed by default
# checkout the image for version specifics
# > https://github.com/actions/runner-images#available-images
- run: npm install
- run: npm run prettier:check
- run: npm run build
- name: install dependencies for tauri
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- working-directory: ./src-tauri
run: cargo check
- working-directory: ./src-tauri
run: cargo fmt --check
32 changes: 0 additions & 32 deletions .github/workflows/on-push-server.yaml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/on-workflow-dispatch-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 🚀 Docker Image

on:
workflow_dispatch:
inputs:
version:
description: 'Version tag for the Docker image (optional, will use latest Git tag if empty)'
required: false
type: string
tag_as_latest:
description: 'Also tag as latest?'
required: false
default: false
type: boolean

jobs:
push-docker-image:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- uses: actions/checkout@v4
- name: Determine tag
id: tag
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
git fetch --all --tags
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
else
TAG=${{ github.event.inputs.version }}
fi
echo "VERSION_TAG=$TAG" >> $GITHUB_ENV
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
install: true
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push
run: |
docker buildx build --push \
--file Dockerfile \
--tag ghcr.io/premai-io/prem-app:$VERSION_TAG \
${{ github.event.inputs.tag_as_latest == 'true' && '--tag ghcr.io/premai-io/prem-app:latest' || '' }} \
--platform linux/arm64,linux/amd64 .
shell: /usr/bin/bash -e {0}
env:
DOCKER_CLI_EXPERIMENTAL: enabled

132 changes: 132 additions & 0 deletions .github/workflows/on-workflow-dispatch-tauri.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: 🚀 Tauri Dekstop App

on:
workflow_dispatch:
inputs:
branchName:
description: 'Branch Name you are releasing from'
required: true
version:
description: 'Version tag for the Github Release and the .dmg for MacOS'
required: true
release_as_draft:
description: 'Release as Draft'
required: false
default: true
type: boolean

jobs:
publish-tauri:
permissions: write-all
strategy:
fail-fast: false
matrix:
platform: [macos-latest]

runs-on: ${{ matrix.platform }}

steps:

- name: View branch name
run: |
echo "Branch name: ${{ github.event.inputs.branchName }}"
- name: View version
run: |
echo "Tag: ${{ github.event.inputs.version }}"
- name: Version as Number
id: next_version
run: |
tag=${{ github.event.inputs.version }}
echo "version=${tag:1}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v3

- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install missing Rust target for universal Mac build
if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"

- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "npm"

- name: Install frontend dependencies
run: npm install


- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.20.1
id: go

- name: Install dasel
run: |
go install github.com/tomwright/dasel/cmd/dasel@latest
- name: Update with latest branch
run: |
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git config pull.rebase true
git stash
git fetch origin ${{ github.event.inputs.branchName }}
git pull origin ${{ github.event.inputs.branchName }}
git stash pop || true
- name: Increment version
run: |
dasel put string -f package.json ".version" "${{ steps.next_version.outputs.version }}"
dasel put string -f src-tauri/tauri.conf.json ".package.version" "${{ steps.next_version.outputs.version }}"
dasel put string -f src-tauri/Cargo.toml ".package.version" "${{ steps.next_version.outputs.version }}"
- name: Build the app
uses: tauri-apps/tauri-action@dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tagName: ${{ github.event.inputs.version }}
releaseName: "PremAI App ${{ github.event.inputs.version }}"
releaseBody: "See the assets to download and install this version."
releaseDraft: ${{ github.event.inputs.release_as_draft }}
includeDebug: true
updaterJsonKeepUniversal: true
args: ${{matrix.platform == 'ubuntu-20.04' && '--target x86_64-unknown-linux-gnu' || '--target universal-apple-darwin'}}


# Commit package.json, tauri.conf.json and Cargo.toml to master
- name: Commit & Push
continue-on-error: true
run: |
git add .
git commit -m "${{ github.event.inputs.version }}"
git push origin HEAD:${{ github.event.inputs.branchName }}
115 changes: 115 additions & 0 deletions docker-compose.gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
version: '3.7'
services:

premapp:
container_name: premapp
build: .
environment:
- VITE_DESTINATION=browser
- VITE_IS_PACKAGED=true
- VITE_PROXY_ENABLED=true
labels:
- "traefik.enable=true"
- "traefik.http.routers.premapp-http.rule=PathPrefix(`/`)"
- "traefik.http.routers.premapp-http.entrypoints=web"
- "traefik.http.services.premapp.loadbalancer.server.port=8080"
ports:
- "8085:8080"
restart: unless-stopped

premd:
container_name: premd
image: ghcr.io/premai-io/premd:7af3782b00f6176b34840f608327c051502511ce
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- PREM_REGISTRY_URL=https://raw.githubusercontent.com/premAI-io/prem-registry/main/manifests.json
- PROXY_ENABLED=True
- DOCKER_NETWORK=prem-app_default
labels:
- "traefik.enable=true"
- "traefik.http.routers.premd.rule=PathPrefix(`/premd`)"
- "traefik.http.middlewares.premd-strip-prefix.stripprefix.prefixes=/premd"
- "traefik.http.routers.premd.middlewares=premd-strip-prefix"
ports:
- "8084:8000"
restart: unless-stopped



traefik:
container_name: traefik
image: traefik:v2.4
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--accesslog=true"
- "--ping"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- traefik-letsencrypt:/letsencrypt
depends_on:
- dnsd
restart: unless-stopped

dnsd:
container_name: dnsd
image: ghcr.io/premai-io/dnsd:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.dnsd.rule=PathPrefix(`/dnsd`)"
- "traefik.http.middlewares.dnsd-strip-prefix.stripprefix.prefixes=/dnsd"
- "traefik.http.routers.dnsd.middlewares=dnsd-strip-prefix"
depends_on:
- dnsd-db-pg
- authd
environment:
PREM_GATEWAY_DNS_DB_USER: root
PREM_GATEWAY_DNS_DB_PASS: secret
PREM_GATEWAY_DNS_DB_NAME: dnsd-db
PREM_GATEWAY_DNS_DB_HOST: dnsd-db-pg
ports:
- "8082:8080"
restart: unless-stopped

dnsd-db-pg:
container_name: dnsd-db-pg
image: postgres:14.7
ports:
- "5432:5432"
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: secret
POSTGRES_DB: dnsd-db
volumes:
- dnsd-pg-data:/var/lib/postgresql/data
restart: unless-stopped

authd:
container_name: authd
image: ghcr.io/premai-io/authd:latest
ports:
- "8081:8080"
restart: unless-stopped

controllerd:
container_name: controllerd
image: ghcr.io/premai-io/controllerd:latest
ports:
- "8083:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
user: root
environment:
LETSENCRYPT_PROD: false
SERVICES: premd,premapp
restart: unless-stopped

volumes:
dnsd-pg-data:
traefik-letsencrypt:
Loading

0 comments on commit 4d16814

Please sign in to comment.