Skip to content

Commit

Permalink
Merge pull request #3 from magicalpuffin/sst-refactor
Browse files Browse the repository at this point in the history
Refactor to use SST, Drizzle, and SvelteKit
  • Loading branch information
magicalpuffin authored Mar 17, 2024
2 parents eab354c + da68783 commit 6eb2352
Show file tree
Hide file tree
Showing 125 changed files with 13,087 additions and 8,821 deletions.
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/sst_deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: SST Deploy

on:
push:
branches: ["main"]

# Concurrency group name ensures concurrent workflow runs wait for any in-progress job to finish
concurrency:
group: merge-${{ github.ref }}

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
DeployApp:
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.IAM_ROLE }}
# role-to-assume: arn:aws:iam::1234567890:role/GitHub
role-duration-seconds: 3600 #adjust as needed for your build time
aws-region: us-west-1
- name: Install frontend dependencies
run: |
npm i
working-directory: ./packages/frontend
- name: Deploy app
run: |
npm i && npx sst deploy --stage prod
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ __pycache__

# local env files
.env*.local

.env
18 changes: 0 additions & 18 deletions Dockerfile-backend

This file was deleted.

18 changes: 0 additions & 18 deletions Dockerfile-frontend

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Demo-Manufacturing-Kanban

**OUTDATED**

A basic demo web app of a manufacturing kanban system. Create workorders, locations and parts. Workorder cards can be dragged and dropped into different locations. Locations can be reorded to indicate sequence production. Workorders can be reordered to indicate priority of production. Data is stored into a sqlite database.

Svelte frontend. Uses tailwindcss, sortablejs, svelte toast.
Expand Down
46 changes: 46 additions & 0 deletions cdk.context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"vpc-provider:account=024589853840:filter.vpc-id=vpc-05aced05d1ac8c50a:region=us-west-1:returnAsymmetricSubnets=true": {
"vpcId": "vpc-05aced05d1ac8c50a",
"vpcCidrBlock": "10.0.0.0/16",
"ownerAccountId": "024589853840",
"availabilityZones": [],
"subnetGroups": [
{
"name": "Isolated",
"type": "Isolated",
"subnets": [
{
"subnetId": "subnet-001b7130c14307d1e",
"cidr": "10.0.128.0/20",
"availabilityZone": "us-west-1a",
"routeTableId": "rtb-0d7180153fc3846be"
},
{
"subnetId": "subnet-0186b876a2538fe39",
"cidr": "10.0.144.0/20",
"availabilityZone": "us-west-1c",
"routeTableId": "rtb-052068b961004a5d1"
}
]
},
{
"name": "Public",
"type": "Public",
"subnets": [
{
"subnetId": "subnet-0025cbd970cd02cdb",
"cidr": "10.0.0.0/20",
"availabilityZone": "us-west-1a",
"routeTableId": "rtb-057911d634c755b22"
},
{
"subnetId": "subnet-042be59640c119864",
"cidr": "10.0.16.0/20",
"availabilityZone": "us-west-1c",
"routeTableId": "rtb-057911d634c755b22"
}
]
}
]
}
}
20 changes: 0 additions & 20 deletions docker-compose.yml

This file was deleted.

16 changes: 16 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Config } from "drizzle-kit";
import * as dotenv from "dotenv";
dotenv.config();

const { DB_URL } = process.env;
if (!DB_URL) {
throw new Error("No url");
}
export default {
schema: "./packages/core/src/schema.ts",
driver: "pg",
out: "./drizzle",
dbCredentials: {
connectionString: DB_URL,
},
} satisfies Config;
30 changes: 30 additions & 0 deletions drizzle/0000_cold_wildside.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CREATE TABLE IF NOT EXISTS "location" (
"id" "smallserial" PRIMARY KEY NOT NULL,
"name" varchar(256) NOT NULL,
"sequence" smallint DEFAULT 0
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "part" (
"id" "smallserial" PRIMARY KEY NOT NULL,
"name" varchar(256) NOT NULL,
"description" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "workOrder" (
"id" "smallserial" PRIMARY KEY NOT NULL,
"name" varchar(256) NOT NULL,
"location_id" smallint NOT NULL,
"part_id" smallint NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "workOrder" ADD CONSTRAINT "workOrder_location_id_location_id_fk" FOREIGN KEY ("location_id") REFERENCES "location"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "workOrder" ADD CONSTRAINT "workOrder_part_id_part_id_fk" FOREIGN KEY ("part_id") REFERENCES "part"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
2 changes: 2 additions & 0 deletions drizzle/0001_loud_black_knight.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "location" ALTER COLUMN "sequence" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "workOrder" ADD COLUMN "priority" smallint DEFAULT 0 NOT NULL;
133 changes: 133 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"id": "fe0dc9be-702f-4372-8d6c-31503eff311a",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
"tables": {
"location": {
"name": "location",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "smallserial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"sequence": {
"name": "sequence",
"type": "smallint",
"primaryKey": false,
"notNull": false,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"part": {
"name": "part",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "smallserial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"workOrder": {
"name": "workOrder",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "smallserial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(256)",
"primaryKey": false,
"notNull": true
},
"location_id": {
"name": "location_id",
"type": "smallint",
"primaryKey": false,
"notNull": true
},
"part_id": {
"name": "part_id",
"type": "smallint",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"workOrder_location_id_location_id_fk": {
"name": "workOrder_location_id_location_id_fk",
"tableFrom": "workOrder",
"tableTo": "location",
"columnsFrom": [
"location_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"workOrder_part_id_part_id_fk": {
"name": "workOrder_part_id_part_id_fk",
"tableFrom": "workOrder",
"tableTo": "part",
"columnsFrom": [
"part_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
Loading

0 comments on commit 6eb2352

Please sign in to comment.