Skip to content

Commit b2f7a78

Browse files
authored
Vercel + onrender (#187)
1 parent 0cebf02 commit b2f7a78

5 files changed

Lines changed: 69 additions & 6 deletions

File tree

docs/data-and-deployment/deploying-to-static-website.md

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Deploying To a Static Website
22

3+
- [Deploying using GitHub](#deploying-using-github)
4+
- [Deploying using Netlify](#deploying-using-netlify)
5+
- [Deploying using Vercel](#deploying-using-vercel)
6+
- [Deploying using render.com](#deploying-using-rendercom)
7+
38
## Deploying using GitHub
49

510
Deploying your study should be relatively simple. We include a GitHub action that will build your study and deploy it to GitHub pages. The only item that the user must adjust is in the `.env` file in the root of the repository. At the top of this file, you should see `VITE_BASE_PATH="/study/"`. Change "/study/" to `"/<repo-name>/"`.
@@ -60,13 +65,71 @@ The first build will take a bit, but once it runs, your experiment should be rea
6065

6166
If you are using Netlify as a secondary venue for anonymization purposes, you can specify which branch Netlify will use to deploy from. For instance a branch called `for-review' might remove all personnel and affiliation information.
6267

68+
## Deploying using Vercel
69+
70+
Deploying with Vercel is also straightforward and follows a very similar configuration process as the other platforms. Ensure that your VITE_BASE_PATH in your .env is like the following:
71+
72+
```
73+
VITE_BASE_PATH="/"
74+
```
75+
76+
At the root of your project, create a `vercel.json` file with the following contents:
77+
78+
```json
79+
{
80+
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
81+
}
82+
```
83+
84+
Then, navigate to Vercel. This will likely require you to sign in or to make an account. From the home page, create a new project.
85+
86+
![Clicking the vercel navbar to pick a new project](./img/vercel_steps/vercel_0.png)
87+
88+
Then, on the next page, select GitHub. This will require you to authorize Vercel as a GitHub app. This will then bring up a list of repos. Select the appropriate repo. This will bring up a configuration screen for the new Vercel project.
89+
90+
![Vercel Demo](./img/vercel_steps/vercel_1.png)
91+
92+
You likely will not need to make any changes to the configuration. After a short period of time, this will yield a website like `https://<APP_NAME>.vercel.app/`
93+
94+
## Deploying using render.com
95+
96+
Deploying with render.com is a little more involved than some of the other options, but has similar bones as the other platforms. Ensure that your VITE_BASE_PATH in your .env is like the following:
97+
98+
```
99+
VITE_BASE_PATH="/"
100+
```
101+
102+
Then, navigate to render.com. This will likely require you to sign in or to make an account. From the home page, create a new project. Select "Static Site" as the type of project you want to create.
103+
104+
![Clicking the render navbar to pick a new project](./img/render_steps/render_0.png)
105+
106+
Then, on the next page, select GitHub. This will require you to authorize render.com as a GitHub app. This will then bring up a list of repos. Select the appropriate repo. This will bring up a configuration screen for the new render.com project.
107+
108+
![Render Demo](./img/render_steps/render_1.png)
109+
110+
On this configuration screen, make sure the following options are set (or accept these defaults if Render has already filled them in for you):
111+
112+
- **Build Command**: `npm run build`
113+
- **Publish Directory**: `dist`
114+
115+
After saving these settings, you will also need to add a rewrite rule. Go to your static site on Render → Redirects/Rewrites tab → Add Rule:
116+
```
117+
Type: Rewrite
118+
Source: /*
119+
Destination: /index.html
120+
```
121+
122+
After adding the rewrite rule, deploy your site. After a protracted period of time, this will yield a website like `https://<APP_NAME>.onrender.com/`
123+
63124
<!-- Importing links -->
125+
64126
import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLinks.tsx';
65127

66128
<StructuredLinks
67-
referenceLinks={[
68-
{name: "GitHub Pages", url: "https://docs.github.com/en/pages/quickstart"},
69-
{name: "GitHub Custom Domain", url: "https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site"},
70-
{name: "Netlify", url: "https://www.netlify.com/"}
71-
]}
72-
/>
129+
referenceLinks={[
130+
{name: "GitHub Pages", url: "https://docs.github.com/en/pages/quickstart"},
131+
{name: "GitHub Custom Domain", url: "https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site"},
132+
{name: "Netlify", url: "https://www.netlify.com/"},
133+
{name: "Vercel", url: "https://vercel.com/"},
134+
{name: "render.com", url: "https://render.com/"}
135+
]}/>
78.4 KB
Loading
257 KB
Loading
68.5 KB
Loading
154 KB
Loading

0 commit comments

Comments
 (0)