2020-12-19 11:22:07 +00:00
< img src = 'https://raw.githubusercontent.com/local-first-web/branding/main/svg/relay-h.svg'
width='600' alt="@localfirst/relay logo"/>
2019-11-12 12:32:34 +00:00
2021-05-10 13:50:56 +00:00
This is a deployment wrapper for [@localfirst/relay ](https://github.com/local-first-web/relay ).
2019-11-12 12:32:34 +00:00
2020-12-17 16:44:23 +00:00
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 ) |
2020-12-18 11:23:17 +00:00
[local server ](#installing-and-running-locally )
2019-11-12 12:32:34 +00:00
2020-12-17 16:44:23 +00:00
## Deploying to Glitch
2019-11-12 12:32:34 +00:00
2020-12-18 11:23:17 +00:00
You can deploy this relay to [Glitch ](https://glitch.com ) by clicking this button:
2019-11-12 12:32:34 +00:00
2020-12-17 16:44:23 +00:00
[![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)
2019-11-12 12:32:34 +00:00
2020-12-17 16:44:23 +00:00
Alternatively, you can remix the [**local-first-relay** ](https://glitch.com/edit/#!/local-first-relay ) project.
2019-11-12 14:06:02 +00:00
2021-05-10 13:50:56 +00:00
![image ](./glitch-screenshot.png )
2019-11-12 14:06:02 +00:00
## Deploying to Heroku
2020-12-17 16:45:11 +00:00
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:
2019-11-12 14:06:02 +00:00
2020-12-17 16:44:23 +00:00
[![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:
2019-11-12 12:42:16 +00:00
2019-11-12 12:32:34 +00:00
```bash
heroku create
2021-05-25 12:51:57 +00:00
git push heroku main
2019-11-12 14:06:02 +00:00
heroku open
```
## Deploying to AWS Elastic Beanstalk
2020-12-17 16:46:20 +00:00
To install using the [AWS CLI ](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv1.html ).
2019-11-12 14:06:02 +00:00
```bash
eb init
eb create
eb open
2019-11-12 12:32:34 +00:00
```
2019-11-12 12:42:16 +00:00
2021-05-10 13:50:56 +00:00
## Deploying to Google Cloud
2019-11-12 14:06:02 +00:00
2020-12-17 16:46:20 +00:00
To install using the [Google Cloud SDK ](https://cloud.google.com/sdk/docs/ ):
2019-11-12 12:42:16 +00:00
```bash
2020-12-17 16:44:23 +00:00
gcloud projects create my-local-first-relay --set-as-default
2019-11-12 14:06:02 +00:00
gcloud app create
gcloud app deploy
gcloud app browse
2019-11-12 12:42:16 +00:00
```
2019-11-12 14:21:51 +00:00
## Deploying to Azure
2020-12-17 16:46:20 +00:00
To install using the [Azure CLI ](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest ) installed:
2019-11-12 14:21:51 +00:00
```bash
2020-12-17 16:44:23 +00:00
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
2019-11-12 17:19:51 +00:00
az webapp deployment user set --user-name USERNAME --password PASSWORD
2020-12-17 16:44:23 +00:00
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
2021-05-25 12:51:57 +00:00
git push azure main
2020-12-17 16:44:23 +00:00
az webapp browse --name my-local-first-relay
2019-11-12 14:21:51 +00:00
```
2019-11-14 16:19:30 +00:00
2020-12-17 16:44:23 +00:00
## Installing and running locally
```bash
yarn
yarn start
```
You should see confirmation on the command line that it's running.
```
🐟 Listening at http://localhost:8080
```
You can visit that address with a web browser to confirm that it's active. If it is, you'll see this:
2021-05-25 12:51:57 +00:00
< img src = 'https://github.com/local-first-web/relay/raw/main/images/screenshot.png' width = '500' align = 'center' / >
2020-12-17 16:44:23 +00:00
## AWS Lambda, Azure Functions, Vercel, Serverless, Cloudwatch Workers, etc.
2019-11-14 16:19:30 +00:00
2020-12-18 11:23:17 +00:00
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.