Skip to content

Commit

Permalink
Merge pull request #5 from drasi-project/gh-hosted
Browse files Browse the repository at this point in the history
Move getting started tutorial to Github
  • Loading branch information
ruokun-niu authored Sep 26, 2024
2 parents 37cea6a + 011d267 commit c0a9a89
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Draft Release

on:
workflow_dispatch:
inputs:
tag:
description: 'Version Tag'
required: true

jobs:
getting_started:
permissions:
contents: write
packages: read
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Zip tutorial folder
run: |
zip -r quickstart-dev-container.zip tutorial/getting-started
- name: Create GitHub Release
run: |
gh release create ${{ inputs.tag }} quickstart-dev-container.zip --draft --title ${{ inputs.tag }}
2 changes: 1 addition & 1 deletion tutorial/getting-started/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"onCreateCommand": "sed -i 's/\r$//' ./.devcontainer/post-create.sh && sed -i 's/\r$//' ./.devcontainer/on-create.sh && bash ./.devcontainer/on-create.sh",
"postCreateCommand": "bash ./.devcontainer/post-create.sh",
"postStartCommand": "nohup bash -c 'kubectl port-forward svc/postgres 5432:5432 -n drasi-system &'",
"postStartCommand": "nohup bash -c 'kubectl port-forward svc/postgres 5432:5432 &'",
"runArgs": [
"--privileged",
"--init"
Expand Down
4 changes: 2 additions & 2 deletions tutorial/getting-started/.devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes postgresql-client

## Install PostgreSQL on K3d
kubectl apply -f https://drasi.blob.core.windows.net/installs/drasi-postgres.yaml -n drasi-system
kubectl apply -f https://raw.githubusercontent.com/drasi-project/learning/main/tutorial/getting-started/resources/drasi-postgres.yaml
sleep 15
kubectl wait --for=condition=ready pod -l app=postgres -n drasi-system --timeout=60s
kubectl wait --for=condition=ready pod -l app=postgres --timeout=60s
74 changes: 74 additions & 0 deletions tutorial/getting-started/resources/drasi-postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-data-init
data:
init.sql: >
CREATE TABLE "Message" (
"MessageId" integer NOT NULL,
"From" character varying(50) NOT NULL,
"Message" character varying(200) NOT NULL
);
ALTER TABLE "Message" ADD CONSTRAINT pk_message
PRIMARY KEY ("MessageId");
INSERT INTO public."Message" VALUES (1, 'Buzz Lightyear', 'To infinity and beyond!');
INSERT INTO public."Message" VALUES (2, 'Brian Kernighan', 'Hello World');
INSERT INTO public."Message" VALUES (3, 'Antoninus', 'I am Spartacus');
INSERT INTO public."Message" VALUES (4, 'David', 'I am Spartacus');
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test-pg-config
labels:
app: postgres
data:
POSTGRES_DB: hello-world
POSTGRES_USER: test
POSTGRES_PASSWORD: test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: postgres:15-alpine
args: ["-c", "wal_level=logical"]
volumeMounts:
- name: init
mountPath: "/docker-entrypoint-initdb.d"
ports:
- containerPort: 5432
envFrom:
- configMapRef:
name: test-pg-config
volumes:
- name: init
configMap:
name: test-data-init
---
apiVersion: v1
kind: Service
metadata:
name: postgres
labels:
app: postgres
spec:
type: ClusterIP
ports:
- port: 5432
selector:
app: postgres
2 changes: 1 addition & 1 deletion tutorial/getting-started/resources/hello-world-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: hello-world
spec:
kind: PostgreSQL
properties:
host: postgres
host: postgres.default.svc.cluster.local
user: test
port: 5432
ssl: false
Expand Down

0 comments on commit c0a9a89

Please sign in to comment.