Compare commits

...

10 commits

Author SHA1 Message Date
Cat /dev/Nulo 00444b8eb4 Add Containerfile 2023-04-30 17:17:39 -03:00
Karissa McKelvey 7ac7bc7737
Update package.json (#1)
* Update package.json

* package.json: support node engines >=10

* yarn.lock: update

* README.md: update references from master to main

Co-authored-by: HerbCaudill <herb@devresults.com>
2021-05-25 14:51:57 +02:00
HerbCaudill 089ad61e1e README.md: update 2021-05-10 15:50:56 +02:00
HerbCaudill 266e48b3c1 README.md: update 2020-12-19 12:22:07 +01:00
HerbCaudill 0c04752c4d update docs 2020-12-18 13:43:19 +01:00
HerbCaudill ec02dd922d server.js: 2020-12-18 13:41:39 +01:00
HerbCaudill ece689fbdf screenshot.png: 2020-12-18 13:41:12 +01:00
HerbCaudill df046a3977 server.js: 2020-12-18 13:33:12 +01:00
HerbCaudill 022bc97cf4 package.json: 2020-12-18 13:33:04 +01:00
HerbCaudill 18af0a9744 README.md: update 2020-12-18 12:23:17 +01:00
7 changed files with 71 additions and 50 deletions

20
Containerfile Normal file
View file

@ -0,0 +1,20 @@
FROM alpine:3.17 as builder
RUN apk add --no-cache nodejs-current yarn
RUN mkdir /app
WORKDIR /app
ENV NODE_ENV production
COPY . .
RUN yarn
FROM alpine:3.17
RUN apk add --no-cache nodejs-current yarn
COPY --from=builder /app /app
WORKDIR /app
ENV NODE_ENV production
ENV PORT 8080
CMD [ "yarn", "start" ]

View file

@ -1,7 +1,7 @@
<img src='https://raw.githubusercontent.com/local-first-web/branding/main/svg/relay-v.svg'
width='250' alt="@localfirst/relay logo"/>
<img src='https://raw.githubusercontent.com/local-first-web/branding/main/svg/relay-h.svg'
width='600' alt="@localfirst/relay logo"/>
This is a deployment wrapper for [@localfirst/relay](https://github.com/local-first-web/relay/packages/relay).
This is a deployment wrapper for [@localfirst/relay](https://github.com/local-first-web/relay).
Jump to instructions for:
[Glitch](#deploying-to-glitch) |
@ -9,17 +9,17 @@ Jump to instructions for:
[AWS](#deploying-to-aws-elastic-beanstalk) |
[Google](#deploying-to-google-cloud) |
[Azure](#deploying-to-azure) |
[local deployment](#installing-and-running-locally)
[local server](#installing-and-running-locally)
## Deploying to Glitch
You can deploy this relay to [Glitch](https://glitch.com) by clicking this button
You can deploy this relay to [Glitch](https://glitch.com) by clicking this button:
[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/github/local-first-web/relay-deployable)
Alternatively, you can remix the [**local-first-relay**](https://glitch.com/edit/#!/local-first-relay) project.
![image](https://user-images.githubusercontent.com/2136620/68673397-ef186800-0553-11ea-9840-45963ad4c18d.png)
![image](./glitch-screenshot.png)
## Deploying to Heroku
@ -31,7 +31,7 @@ Or, you can install using the [Heroku CLI](https://devcenter.heroku.com/articles
```bash
heroku create
git push heroku master
git push heroku main
heroku open
```
@ -45,7 +45,7 @@ eb create
eb open
```
## Deploying to Google Clou
## Deploying to Google Cloud
To install using the [Google Cloud SDK](https://cloud.google.com/sdk/docs/):
@ -68,7 +68,7 @@ az webapp create --name my-local-first-relay --plan my-local-first-relay
az webapp deployment user set --user-name USERNAME --password PASSWORD
az webapp deployment source config-local-git --name my-local-first-relay
git remote add azure https://USERNAME@my-local-first-relay.scm.azurewebsites.net/my-local-first-relay.git
git push azure master
git push azure main
az webapp browse --name my-local-first-relay
```
@ -87,8 +87,10 @@ You should see confirmation on the command line that it's running.
You can visit that address with a web browser to confirm that it's active. If it is, you'll see this:
<img src='./screenshot.png' width='500' align='center' />
<img src='https://github.com/local-first-web/relay/raw/main/images/screenshot.png' width='500' align='center' />
## AWS Lambda, Azure Functions, Vercel, Serverless, Cloudwatch Workers, etc.
Since true serverless functions are stateless and only spun up on demand, they're not a good fit for this server, which needs to remember information about connected peers and maintain a stable websocket connection with each one.
Since true serverless functions are stateless and only spun up on demand, they're not a good fit for
this server, which needs to remember information about connected peers and maintain a stable
websocket connection with each one.

BIN
glitch-screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View file

@ -1,8 +1,8 @@
{
"name": "cevitxe-signal-server-standalone",
"name": "@localfirst/relay-deployable",
"version": "1.0.0",
"description": "Deployable signal server for Cevitxe",
"repository": "https://github.com/devresults/cevitxe-signal-server-standalone",
"description": "Deployment wrapper for @localfirst/relay",
"repository": "https://github.com/local-first-web/relay-deployable",
"author": "Herb Caudill <herb@devresults.com>",
"license": "MIT",
"private": false,
@ -10,9 +10,9 @@
"start": "node server.js"
},
"dependencies": {
"cevitxe-signal-server": "^0.3.0"
"@localfirst/relay": "3"
},
"engines": {
"node": "10.X"
"node": ">=10"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View file

@ -1,8 +1,8 @@
const { Server } = require("cevitxe-signal-server/dist");
const { Server } = require('@localfirst/relay/dist')
const DEFAULT_PORT = 8080;
const port = Number(process.env.PORT) || DEFAULT_PORT;
const DEFAULT_PORT = 8080
const port = Number(process.env.PORT) || DEFAULT_PORT
const server = new Server({ port });
const server = new Server({ port })
server.listen();
server.listen()

View file

@ -2,6 +2,17 @@
# yarn lockfile v1
"@localfirst/relay@3":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@localfirst/relay/-/relay-3.2.0.tgz#539d6a7ca1d28f39351c82f484daf2136c8c39b3"
integrity sha512-HQbWVbGTs/Vjb1bdGmvD8Cfv9vey6tynHOXqOnV4tVtdyMsommDyzDZn8nfQIIUW8Xj3hNWxHz+yCmhMXOj35A==
dependencies:
debug "4"
eventemitter3 "4"
express "4"
express-ws "4"
ws "7"
accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
@ -20,13 +31,6 @@ async-limiter@^1.0.0, async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
base-x@^3.0.2:
version "3.0.7"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.7.tgz#1c5a7fafe8f66b4114063e8da102799d4e7c408f"
integrity sha512-zAKJGuQPihXW22fkrfOclUUZXM2g92z5GzlSMHxhO6r6Qj+Nm0ccaGNBzDZojzwOMkpjAv4J0fOv1U4go+a4iw==
dependencies:
safe-buffer "^5.0.1"
body-parser@1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
@ -43,28 +47,11 @@ body-parser@1.19.0:
raw-body "2.4.0"
type-is "~1.6.17"
bs58@4:
version "4.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
integrity sha1-vhYedsNU9veIrkBx9j806MTwpCo=
dependencies:
base-x "^3.0.2"
bytes@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==
cevitxe-signal-server@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/cevitxe-signal-server/-/cevitxe-signal-server-0.3.0.tgz#61506a8eb86166222452ea66b13dedd9cf22b1a5"
integrity sha512-ysO2BIuYQzjJLqp8ZoKC8youBU7KI7K8fCDx1bda31v07Hh4k5LefTrThT0/Zj/Vkb4JjZNrR0HVB0h895n0Mg==
dependencies:
bs58 "4"
express "4"
express-ws "4"
ws "7"
content-disposition@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
@ -94,6 +81,13 @@ debug@2.6.9:
dependencies:
ms "2.0.0"
debug@4:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
dependencies:
ms "2.1.2"
depd@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
@ -124,6 +118,11 @@ etag@~1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
eventemitter3@4:
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
express-ws@4:
version "4.0.0"
resolved "https://registry.yarnpkg.com/express-ws/-/express-ws-4.0.0.tgz#dabd8dc974516418902a41fe6e30ed949b4d36c4"
@ -276,6 +275,11 @@ ms@2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
negotiator@0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
@ -331,11 +335,6 @@ safe-buffer@5.1.2:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
safe-buffer@^5.0.1:
version "5.2.0"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"