-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bb267b
commit 9c856c4
Showing
2 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ width='600' alt="@localfirst/relay logo"/> | |
other devices. It can run in the cloud or on any device with a known address. | ||
|
||
Deploy to: | ||
[Glitch](http://github.com/local-first-web/relay-deployable#deploying-to-glitch) | | ||
[Heroku](http://github.com/local-first-web/relay-deployable#deploying-to-heroku) | | ||
[AWS](http://github.com/local-first-web/relay-deployable#deploying-to-aws-elastic-beanstalk) | | ||
[Google](http://github.com/local-first-web/relay-deployable#deploying-to-google-cloud) | | ||
[Azure](http://github.com/local-first-web/relay-deployable#deploying-to-azure) | | ||
[local server](http://github.com/local-first-web/relay-deployable#installing-and-running-locally) | ||
[Glitch](#deploying-to-glitch) | | ||
[Heroku](#deploying-to-heroku) | | ||
[AWS](#deploying-to-aws-elastic-beanstalk) | | ||
[Google](#deploying-to-google-cloud) | | ||
[Azure](#deploying-to-azure) | | ||
[local server](#installing-and-running-locally) | ||
|
||
## Why | ||
|
||
|
@@ -52,13 +52,13 @@ requests from Alice and Bob, we pipe their sockets together. | |
From this monorepo, you can run this server as follows: | ||
|
||
```bash | ||
$ pnpm start | ||
pnpm | ||
pnpm start | ||
``` | ||
|
||
You should see something like thsi: | ||
|
||
```bash | ||
yarn run v1.22.4 | ||
> @localfirst/[email protected] start local-first-web/relay | ||
> node dist/start.js | ||
|
||
|
@@ -175,6 +175,83 @@ together and leaves them to talk. | |
The client and server don't communicate with each other via the `connection` endpoint; it's purely a | ||
relay between two peers. | ||
|
||
## Deployment | ||
|
||
Jump to instructions for: | ||
[Glitch](#deploying-to-glitch) | | ||
[Heroku](#deploying-to-heroku) | | ||
[AWS](#deploying-to-aws-elastic-beanstalk) | | ||
[Google](#deploying-to-google-cloud) | | ||
[Azure](#deploying-to-azure) | | ||
[local server](#installing-and-running-locally) | ||
|
||
### Deploying to Glitch | ||
|
||
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) | ||
|
||
Alternatively, you can remix the [**local-first-relay**](https://glitch.com/edit/#!/local-first-relay) project. | ||
|
||
![image](./glitch-screenshot.png) | ||
|
||
### Deploying to Heroku | ||
|
||
This server can be deployed to [Heroku](https://heroku.com). By design, it should only ever run with a single dyno. You can deploy it by clicking on this button: | ||
|
||
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) | ||
|
||
Or, you can install using the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) as follows: | ||
|
||
```bash | ||
heroku create | ||
git push heroku main | ||
heroku open | ||
``` | ||
|
||
### Deploying to AWS Elastic Beanstalk | ||
|
||
To install using the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html). | ||
|
||
```bash | ||
eb init | ||
eb create | ||
eb open | ||
``` | ||
|
||
### Deploying to Google Cloud | ||
|
||
To install using the [Google Cloud SDK](https://cloud.google.com/sdk/docs/): | ||
|
||
```bash | ||
gcloud projects create my-local-first-relay --set-as-default | ||
gcloud app create | ||
gcloud app deploy | ||
gcloud app browse | ||
``` | ||
|
||
### Deploying to Azure | ||
|
||
To install using the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) installed: | ||
|
||
```bash | ||
az group create --name my-local-first-relay --location eastus | ||
az configure --defaults group=my-local-first-relay location=eastus | ||
az appservice plan create --name my-local-first-relay --sku F1 | ||
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://[email protected]/my-local-first-relay.git | ||
git push azure main | ||
az webapp browse --name my-local-first-relay | ||
``` | ||
|
||
### 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. | ||
|
||
## License | ||
|
||
MIT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters