Skip to content

Commit

Permalink
deploy worker from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrach-tayo committed Dec 16, 2024
1 parent 05f2da4 commit 5a77941
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 9 deletions.
4 changes: 2 additions & 2 deletions desci-repo/kubernetes/deployment_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ spec:
export DATABASE_URL={{ .Data.DATABASE_URL }}
export IPFS_RESOLVER_OVERRIDE={{ .Data.IPFS_RESOLVER_OVERRIDE }}
export DESCI_SERVER_URL={{ .Data.DESCI_SERVER_URL }}
export PARTY_SERVER_HOST={{ .Data.PARTY_SERVER_HOST }}
export PARTY_SERVER_TOKEN={{ .Data.PARTY_SERVER_TOKEN }}
export PARTY_SERVER_HOST=nodes-dev-sync.desci.com
export PARTY_SERVER_TOKEN=auth-token
export ENABLE_PARTYKIT_FEATURE=true
export PINO_LOG_LEVEL=info
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions desci-repo/kubernetes/deployment_prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ spec:
export DATABASE_URL={{ .Data.DATABASE_URL }}
export IPFS_RESOLVER_OVERRIDE={{ .Data.IPFS_RESOLVER_OVERRIDE }}
export DESCI_SERVER_URL={{ .Data.DESCI_SERVER_URL }}
export PARTY_SERVER_HOST={{ .Data.PARTY_SERVER_HOST }}
export PARTY_SERVER_TOKEN={{ .Data.PARTY_SERVER_TOKEN }}
export PARTY_SERVER_HOST=nodes-sync.desci.com
export PARTY_SERVER_TOKEN=auth-token
export ENABLE_PARTYKIT_FEATURE=true
export PINO_LOG_LEVEL=info
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions desci-repo/kubernetes/deployment_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ spec:
export DATABASE_URL={{ .Data.DATABASE_URL }}
export IPFS_RESOLVER_OVERRIDE={{ .Data.IPFS_RESOLVER_OVERRIDE }}
export DESCI_SERVER_URL={{ .Data.DESCI_SERVER_URL }}
export PARTY_SERVER_HOST={{ .Data.PARTY_SERVER_HOST }}
export PARTY_SERVER_TOKEN={{ .Data.PARTY_SERVER_TOKEN }}
export PARTY_SERVER_HOST=nodes-sync.desci.com
export PARTY_SERVER_TOKEN=auth-token
export ENABLE_PARTYKIT_FEATURE=true
export PINO_LOG_LEVEL=info
{{- end -}}
Expand Down
1 change: 0 additions & 1 deletion sync-server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ repo-tmp
COMMANDS
.storage
worker.capnp
wrangler.toml
docker-compose.debug.yml
1 change: 1 addition & 0 deletions sync-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class AutomergeServer extends PartyServer {
this.env.DATABASE_URL ?? process.env.WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_NODES_DB ?? '<DATABASE_URL>';
this.DATABASE_URL = this.environment === 'dev' ? localDbUrl : this.env.NODES_DB.connectionString;
this.API_TOKEN = env.API_TOKEN || 'auth-token';
console.log('[Values]', { db: this.DATABASE_URL, api: this.API_TOKEN, env: this.environment });
}

async onStart(): Promise<void> {
Expand Down
3 changes: 1 addition & 2 deletions sync-server/template.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Top-level configuration
name = "automerge-sync-worker"
name = "automerge-sync-server"
main = "src/index.ts"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat_v2"]
find_additional_modules = true
ip = "127.0.0.1"

[[durable_objects.bindings]]
name = "Automerge"
Expand Down
55 changes: 55 additions & 0 deletions sync-server/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Top-level configuration
name = "automerge-sync-server"
main = "src/index.ts"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat_v2"]
find_additional_modules = true

[[durable_objects.bindings]]
name = "Automerge"
class_name = "AutomergeServer"

[[migrations]]
tag = "v1"
new_classes = ["AutomergeServer"]

[observability]
enabled = true
head_sampling_rate = 1 # optional. default = 1.

[[hyperdrive]]
binding = "NODES_DB"
id = "856af129675e4140accc0ccabbc2ee20"
localConnectionString = "postgresql://walter:white@host.docker.internal:5434/boilerplate"

[vars]
DB_TABLE= "DocumentStore"
NODES_API= "http://localhost:5420"
ENVIRONMENT="dev"
DATABASE_URL= "postgresql://walter:white@host.docker.internal:5434/boilerplate"

[env.dev]
durable_objects.bindings = [{ name = "Automerge", class_name = "AutomergeServer" }]
vars = { DB_TABLE= "DocumentStore", NODES_API= "http://localhost:5420", ENVIRONMENT="dev", DATABASE_URL= "postgresql://walter:white@host.docker.internal:5434/boilerplate" }
hyperdrive = [{ binding = "NODES_DB", id = "856af129675e4140accc0ccabbc2ee20" }]

[env.staging]
vars = { ENVIRONMENT = "staging", DB_TABLE= "DocumentStore", NODES_API= "https://nodes-api-dev.desci.com" }
hyperdrive = [{ binding = "NODES_DB", id = "0475d48544a641ffa514488c6e94911e" }]
durable_objects.bindings = [{ name = "Automerge", class_name = "AutomergeServer" }]
routes = [
{ pattern = "nodes-dev-sync.desci.com", custom_domain = true }
]

[env.production]
vars = { ENVIRONMENT = "production", DB_TABLE= "DocumentStore", NODES_API= "https://nodes-api.desci.com" }
hyperdrive = [{ binding = "NODES_DB", id = "21c45695583b4d8aa6655735efc4aa28" }]
durable_objects.bindings = [{ name = "Automerge", class_name = "AutomergeServer" }]
routes = [
{ pattern = "nodes-sync.desci.com", custom_domain = true }
]

[[rules]]
type = "CompiledWasm"
globs = ["**/*automerge_wasm_bg.wasm"]
fallthrough = true

0 comments on commit 5a77941

Please sign in to comment.