refactor: Deployment setup

This commit is contained in:
Prad Nukala 2024-11-26 11:44:17 -05:00
parent b9b868d55a
commit e89bbb05b1
11 changed files with 106 additions and 3545 deletions

2
.gitignore vendored
View File

@ -11,6 +11,8 @@
aof*
dist
**/.haptic
static
pkg/webapp/dist
# Test binary
*.test

View File

@ -262,6 +262,9 @@ ictest-tokenfactory:
### testnet ###
###############################################################################
setup-ipfs:
./scripts/ipfs_config.sh
setup-testnet: mod-tidy is-localic-installed install local-image set-testnet-configs setup-testnet-keys
# Run this before testnet keys are added
@ -291,25 +294,19 @@ sh-testnet: mod-tidy
###############################################################################
### generation ###
###############################################################################
.PHONY: buf-deploy pkl-gen tailwind-gen templ-gen
buf-deploy:
cd ./proto && bunx buf dep update && bunx buf build && bunx buf push
pkl-deploy:
sh ./scripts/upload_pkl.sh
.PHONY: pkl-gen styles-gen templ-gen
pkl-gen:
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
pkl-gen-go pkl/base.types/Ctx.pkl
pkl-gen-go pkl/base.types/DWN.pkl
pkl-gen-go pkl/base.types/ORM.pkl
tailwind-gen:
cd ./pkg/webapp && bun install && bun run build
cp ./pkg/webapp/components/styles/styles.css ./cmd/hway/styles.css
rm -rf ./pkg/webapp/node_modules
styles-gen:
sh ./scripts/tailwindgen.sh
templ-gen:
@go install github.com/a-h/templ/cmd/templ@latest
templ generate
@ -318,15 +315,23 @@ templ-gen:
###############################################################################
.PHONY: motr-build hway-build hway-serve
buf-deploy:
motr-build:
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
hway-build: styles-gen templ-gen
go build -o build/hway ./cmd/hway/main.go
###############################################################################
### help ###
###############################################################################
.PHONY: deploy-buf deploy-cdn
deploy-buf:
cd ./proto && bunx buf dep update && bunx buf build && bunx buf push
motr-build:
GOOS=js GOARCH=wasm go build -o build/app.wasm ./cmd/motr/main.go
hway-build: tailwind-gen templ-gen
go build -o build/hway ./cmd/hway/main.go
deploy-cdn:
sh ./scripts/upload_cdn.sh
###############################################################################

View File

@ -26,9 +26,9 @@
"init_hook": ["export ROOT=$(git rev-parse --show-toplevel)"],
"scripts": {
"devnet": ["cd $ROOT", "make sh-testnet"],
"ipfs": ["ipfs daemon"],
"ipfs": ["cd $ROOT", "make setup-ipfs", "ipfs daemon"],
"air": ["cd $ROOT", "air"],
"gex": ["gex"]
"gex": ["go install github.com/cosmos/gex@latest", "gex"]
}
}
}

View File

@ -1,32 +1,23 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
"packages": [
"go@1.22",
"bun@latest",
"ipfs@latest",
"templ@latest",
"gum@latest"
],
"packages": ["go@1.22", "bun@latest", "gum@latest"],
"env": {
"GOPATH": "$HOME/go",
"PATH": "./build:$HOME/go/bin:$PATH",
"TEMPL_EXPERIMENT": "rawgo"
},
"shell": {
"init_hook": [
"./scripts/init_env.sh"
],
"scripts": {
"start-local": [
"cd deploy/local && devbox services up"
"deploy-buf": ["gum spin --title='Deploying buf' -- make deploy-buf"],
"deploy-cdn": [
"gum spin --title='Generating PKL' -- make pkl-gen",
"gum spin --title='Generating Styles' -- make styles-gen",
"gum spin --title='Building Motr WASM' -- make motr-build",
"gum spin --title='Uploading to Bucket' -- make deploy-cdn"
],
"start-testnet": [
"cd deploy/testnet && devbox services up"
],
"start-gex": [
"go install github.com/cosmos/gex@latest",
"gex"
]
"start-local": ["cd deploy/local && devbox services up"],
"start-testnet": ["cd deploy/testnet && devbox services up"],
"start-gex": ["go install github.com/cosmos/gex@latest", "gex"]
}
}
}

View File

@ -97,6 +97,54 @@
}
}
},
"gum@latest": {
"last_modified": "2024-11-16T04:25:12Z",
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#gum",
"source": "devbox-search",
"version": "0.14.5",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5"
}
}
},
"ipfs@latest": {
"last_modified": "2023-02-24T09:01:09Z",
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"name": "@onsonr/nebula",
"version": "0.0.2",
"scripts": {
"build": "bunx tailwindcss -i ./components/globals.css -o ./components/styles/styles.css"
"build": "bunx tailwindcss -i ./globals.css -o ./dist/styles.css"
},
"dependencies": {
"@tailwindcss/forms": "^0.5.7",

View File

@ -1,7 +1,5 @@
#!/bin/bash
go install github.com/cosmos/gex@latest
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
rm -rf ~/.ipfs

17
scripts/tailwindgen.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
STYLES_DIR=$ROOT_DIR/pkg/webapp
DIST_DIR=$STYLES_DIR/dist
OUT_DIR=$ROOT_DIR/static/css
cd $STYLES_DIR
bun install
bun run build
mkdir -p $OUT_DIR
mv $DIST_DIR/styles.css $OUT_DIR/styles.css
rm -rf $DIST_DIR
rm -rf $STYLES_DIR/node_modules

View File

@ -12,3 +12,6 @@ for dir in .out/*/; do
done
rm -rf .out
rclone copy $ROOT_DIR/static "r2:nebula"
rm -rf $ROOT_DIR/static