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

Deploy #2

Merged
merged 11 commits into from
Oct 5, 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
65 changes: 65 additions & 0 deletions .github/workflows/deploy-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

name: Deploy to demo

on:
workflow_dispatch:
push:

permissions:
contents: read
id-token: 'write'
packages: read

jobs:

deploy:

name: Deploy to demo
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Get version
id: version
run: echo VERSION=$(git describe --exact-match --tags | sed 's/^v//') >> $GITHUB_OUTPUT

- name: Install deps
run: npm install

- name: Build container
run: make VERSION=${{ steps.version.outputs.VERSION }}

- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: projects/583813057664/locations/global/workloadIdentityPools/deploy/providers/github
service_account: [email protected]
access_token_lifetime: 900s
create_credentials_file: true

- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Install Pulumi
run: cd pulumi && npm install

- name: Applying infrastructure 🚀🙏
uses: pulumi/actions@v3
with:
command: up
stack-name: demo
work-dir: pulumi
cloud-url: gs://trustgraph-deploy/config-ui/demo
env:
PULUMI_CONFIG_PASSPHRASE: ""
IMAGE_VERSION: ${{ steps.version.outputs.VERSION }}

45 changes: 45 additions & 0 deletions .github/workflows/undeploy-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

name: Undeploy to demo

on:
workflow_dispatch:

permissions:
contents: read
id-token: 'write'

jobs:

deploy:

name: Undeploy to demo
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v0
with:
token_format: access_token
workload_identity_provider: projects/514167726704/locations/global/workloadIdentityPools/deploy/providers/deploy
service_account: [email protected]
access_token_lifetime: 900s
create_credentials_file: true

- name: Install Pulumi
run: cd pulumi && npm install

- name: Destroy infrastructure ☠🔥
uses: pulumi/actions@v3
with:
command: destroy
stack-name: demo
work-dir: pulumi
cloud-url: gs://kalntera-deploy/cybersec-ai/demo
env:
PULUMI_CONFIG_PASSPHRASE: ""

4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ RUN mkdir /root/wheels

RUN pip wheel -w /root/wheels --no-deps jsonnet

COPY simple-config-ui /root/simple-config-ui/
COPY config-ui /root/config-ui/

RUN (cd /root/simple-config-ui && pip wheel -w /root/wheels --no-deps .)
RUN (cd /root/config-ui && pip wheel -w /root/wheels --no-deps .)

FROM alpine:3.20

Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ all: service-package container

ui:
npm run build
rm -rf simple-config-ui/config_ui/ui/
cp -r dist/ simple-config-ui/config_ui/ui/
rm -rf config-ui/config_ui/ui/
cp -r dist/ config-ui/config_ui/ui/

template-data:
rm -rf simple-config-ui/config_ui/templates
mkdir -p simple-config-ui/config_ui/templates
find templates -name '*.jsonnet' | cpio -pdm simple-config-ui/config_ui/
rm -rf config-ui/config_ui/templates
mkdir -p config-ui/config_ui/templates
find templates -name '*.jsonnet' | cpio -pdm config-ui/config_ui/

resources-data:
rm -rf simple-config-ui/config_ui/resources
mkdir -p simple-config-ui/config_ui/resources
cp -r grafana simple-config-ui/config_ui/resources/
cp -r prometheus simple-config-ui/config_ui/resources/
rm -rf config-ui/config_ui/resources
mkdir -p config-ui/config_ui/resources
cp -r grafana config-ui/config_ui/resources/
cp -r prometheus config-ui/config_ui/resources/

service-package: ui template-data resources-data update-package-versions
cd simple-config-ui && python3 setup.py sdist --dist-dir ../pkgs/
cd config-ui && python3 setup.py sdist --dist-dir ../pkgs/

update-package-versions:
echo __version__ = \"${VERSION}\" > simple-config-ui/config_ui/version.py
echo __version__ = \"${VERSION}\" > config-ui/config_ui/version.py

CONTAINER=docker.io/trustgraph/simple-config-ui
CONTAINER=docker.io/trustgraph/config-ui
DOCKER=podman

container:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions simple-config-ui/setup.py → config-ui/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
version = version_module.__version__

setuptools.setup(
name="simple-config-ui",
name="config-ui",
version=version,
author="trustgraph.ai",
author_email="[email protected]",
description="Simple configuration creator for trustgraph.ai",
description="Configuration creator for trustgraph.ai",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/trustgraph-ai/simple-config-ui",
Expand Down
14 changes: 14 additions & 0 deletions pulumi/Pulumi.demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
encryptionsalt: v1:vQGk98eEeYI=:v1:tHg+f1b66tEydgA9:J1RGVNI0FssyjSXVhcKU7bfBofNFTg==
config:
simple-config-ui:artifact-name: simple-config-ui
simple-config-ui:artifact-repo: us-central1-docker.pkg.dev/trustgraph-demo/simple-config-ui
simple-config-ui:artifact-repo-region: us-central1
simple-config-ui:cloud-run-region: us-central1
simple-config-ui:domain: demo.trustgraph.ai
simple-config-ui:environment: demo
simple-config-ui:gcp-project: trustgraph-demo
simple-config-ui:gcp-region: us-central1
simple-config-ui:hostname: simple-config-ui.demo.trustgraph.ai
simple-config-ui:managed-zone: demo
simple-config-ui:max-scale: "2"
simple-config-ui:min-scale: "0"
3 changes: 3 additions & 0 deletions pulumi/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: simple-config-ui
runtime: nodejs
description: Simple config UI
Loading
Loading