Skip to content

Commit

Permalink
merge: release deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
chase-moskal committed Sep 15, 2024
2 parents 06218b8 + 083adfd commit 845d413
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: 🚀 release to github pages
name: 🚀 full release deployment
on:
push:
branches: ["release"]
Expand Down Expand Up @@ -38,6 +38,15 @@ jobs:
run: |
rm -rf x/assets
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.REGIS_DIRECTOR_DEPLOYER_SSH_PRIVATE_KEY }}

- name: deploy the director
run: |
rsync -vhamz --delete --exclude ".git" --exclude "node_modules" -e "ssh -o StrictHostKeyChecking=no" ./ [email protected]:/home/deployer/app/
ssh -o StrictHostKeyChecking=no [email protected] "cd /home/deployer/app && bin/serverside/redeploy"
- name: 🌎 download assets
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
16 changes: 16 additions & 0 deletions bin/serverside/redeploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

#
# this script is meant to be run on the director's production server.
# do not run this locally in your dev environment..
#

# prepare the environment
source "$HOME/.profile"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

npm ci --omit=dev

pm2 restart director || pm2 start "npm run director --silent" --name director

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,24 @@
"unmount": "bin/unmount",
"assets-down": "bin/assets-down",
"assets-up": "bin/assets-up",

"build": "rm -rf x && turtle build --out=x -v && turtle ssg --in=s,x --out=x --exclude=bin -v && run-s links",
"links": "mkdir -p assets/x && ln -s \"$(realpath assets/x)\" x/assets && ln -s \"$(realpath s)\" x/s",

"http": "http-server x",
"watch": "turtle watch --in=s,x --out=x --exclude=bin -v",
"start": "run-p http watch",
"director": "node x/director/plumbing/server.js",

"devlinks": "run-s devlinks-toolbox devlinks-slate devlinks-renraku",
"devlinks-toolbox": "rm -rf node_modules/@benev/toolbox && ln -s \"$(realpath ../toolbox)\" node_modules/@benev/toolbox",
"devlinks-slate": "rm -rf node_modules/@benev/slate && ln -s \"$(realpath ../slate)\" node_modules/@benev/slate",
"devlinks-renraku": "rm -rf node_modules/renraku && ln -s \"$(realpath ../../renraku)\" node_modules/renraku",

"test": "cynic node x/tests.test.js",
"test-watch": "chokidar \"x/**/*.js\" -c \"clear && npm test\"",
"count": "find s -path '*/_archive' -prune -o -name '*.ts' -exec wc -l {} +"
},
"dependencies": {
"@babylonjs/core": "^7.25.1",
"@babylonjs/loaders": "^7.25.1",
"@benev/argv": "^0.3.7",
"@benev/slate": "^0.2.2",
"@benev/toolbox": "^0.6.2",
"es-module-shims": "^1.10.0",
Expand Down
16 changes: 14 additions & 2 deletions s/director/plumbing/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import "@benev/slate/x/node.js"
import {cli, command, param, number} from "@benev/argv"
import {expose, remote, errstring, remoteErrstring} from "renraku"
import {deathWithDignity, WebSocketServer} from "renraku/x/node.js"

Expand All @@ -8,11 +9,22 @@ import {Director} from "../director.js"
import {constants} from "../../constants.js"
import {Clientside} from "../apis/clientside.js"

const host = "0.0.0.0"
const port = 8000

deathWithDignity({logger})

const {params} = cli(process.argv, {
name: "director",
commands: command({
args: [],
params: {
port: param.default(number, "8000"),
},
}),
}).tree

const host = "0.0.0.0"
const {port} = params

const director = new Director()

const server = new WebSocketServer({
Expand Down
12 changes: 10 additions & 2 deletions s/net/connectivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import {Serverside} from "../director/apis/serverside.js"
import {ClientMachinery} from "../director/plumbing/machinery.js"
import {makeDirectorClient} from "../director/plumbing/client.js"

const url = `//${window.location.hostname}:8000/`
const isLocalDev = (
location.host.startsWith("localhost") ||
location.host.startsWith("192.168") ||
location.host.startsWith("10.0.0")
)

const directorUrl = isLocalDev
? `//${window.location.hostname}:8000/`
: `wss://director.regis.gg/`

export type Connection = {
socket: WebSocket
Expand Down Expand Up @@ -44,7 +52,7 @@ export class Connectivity {
console.log("attempt connect")
const connection = await this.connection.load(async() => {
try {
const client = await makeDirectorClient(url, this.machinery)
const client = await makeDirectorClient(directorUrl, this.machinery)
const info = await queryReport(client.serverside)
const lost = () => {
console.log("connection lost")
Expand Down

0 comments on commit 845d413

Please sign in to comment.