--- orphan: true --- # Nightscout in Render
```{admonition} Too complicated? Not what you're looking for? :class: seealso Consider a hosted Nightscout service! Check for easier solutions [here](/index.md#nightscout-as-a-service). ```
```{card} ## Render ![Render Free](/vendors/img/Render.png) ^^^ You can create your Nightscout site in Render. **Pros**: * No credit card required **Cons**: * The free plan doesn't guarantee any reliability * App will sleep after 15 minutes * Render URLs are considered unsafe by some internet providers * Relying on the MongoDB Atlas database ```
------ ## Step 0: Create a database ```{admonition} Render doesn't include a database :class: note Make sure you [created one](/nightscout/database) before starting your Nightscout web app creation with Render. Come back here when you have a MONGODB_URI connection string. ``` ```{admonition} Migrating? :class: tip Copy the connection string from your previous platform: [edit the variables](/nightscout/setup_variables.md#nightscout-configuration) and look for `MONGODB_URI`. If you don't see `MONGODB_URI` but see `MONGO_CONNECTION` (**NOT** `MONGO_COLLECTION`): use its value. ```
## Step 1: Create a GitHub account and fork the Nightscout project ```{tab-set} :::{tab-item} I don't have a GitHub Account ### Create a GitHub account ::: {include} /vendors/github/create.md ::: :::{tab-item} I already have a GitHub Account ### Update your Nightscout fork :::{include} /vendors/github/update_b.md ::: ```
## Step 2: Add the `render.yaml` template - Sign in your GitHub account: [https://github.com/login](https://github.com/login).
- Select your own `cgm-remote-monitor` project.
1. Open the branches list 2. Type `render` 3. Select Create a branch: render from 'master'
* Select Add File - Create new file
* Type `render.yaml` for the name. Leave it open like that for now.
* Open the `render.txt` template from [here](/_static/render.txt) and edit it with a notepad app, **select all**, copy and paste into the GitHub page you have open from above.
* Scroll up the page in GitHub and select `Commit changes` top right.
* Confirm with `Commit changes`.
* Your cgm-remote-monitor project is ready for Render Blueprints deploy.
## Step 3: Create a Render account a) Open a new browser page in [Render](https://render.com/) and select `GET STARTED FOR FREE`
b) Sign up with GitHub
c) `Authorize Render`
d) `COMPLETE SIGN UP` with your GitHub account email
e) Check your inbox and click the confirmation link

## Step 4: First deploy in Render a) Select `Blueprints`
b) Then `New blueprint instance`
c) `Connect` your `cgm-remote-monitor` project
d) Enter a name for your blueprint (anything simple, Nightscout is ok)
e) Click the drop down menu of `Branch` (1) then select `render` (2)
**You now need to setup core variables for your site:**
f) In `MONGODB_URI` paste your database connection string from Step 0 above g) `API_SECRET` will be your Nightscout site password, it needs to be at least 12 characters long and you should **NOT use spaces** if you use @ or ! symbols remember you will probably need to express them using [Percent encoding](https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters) in your uploader and downloader apps. If you're not sure on how to do this, it is recommended to use only letters (uppercase + lowercase) and digits. ```{warning} The API_SECRET is the **main password allowing full access to your Nightscout site**. Make sure it's reasonably secure (mix uppercase and lowercase letters, plus digits) and **do no not share it publicly**. If you think you exposed it by mistake, it is recommended that you **change it**. ``` h) Define your `DISPLAY_UNITS` Acceptable choices for the units used in Nightscout are `mg/dl` or `mmol/L` (or just `mmol`).
i) Once all three variables have been set, `Apply`
j) Your Nightscout site will be deployed. Wait until the operation completes after some minutes.
Congratulations. You created your new Nightscout site with Render. The following step is important, don't skip it.
## Step 5: Delete the `render` branch ```{hint} In order to deploy your site with a blueprint, you needed to modify your GitHub repository. Now you want to remove this modification so that you'll be able to update it normally. ``` - Sign in your GitHub account: [https://github.com/login](https://github.com/login).
- Select your own `cgm-remote-monitor` project.
* Click on branches to display all.
* Locate the `render` branch and click on the bin icon to delete it.
You have successfully removed the temporary modification required to deploy a new Render site.
* Your Render site will redeploy using the normal `master` branch of `cgm-remote-monitor`, wait a few minutes until the operation completes.
* From the menu, `Dashboard`, then select your web service (the one you defined in step **4d**).
* This is your new Nightscout site, click on the URL to open it

```{include} /nightscout/first_setup.md ```
## Editing Variables in Render
* Sign in [Render](https://dashboard.render.com/) with GitHub
* Select your web service * Go to `Environment`, your variables will display * You can modify variables by making the changes directly in the text boxes. You can also add variables with `Add environment variable`. When you're done, scroll down and `Save changes`. * Wait a few minutes for your site to redeploy. You can track the status in `Events`.