Skip to content

Commit

Permalink
Northflank rework
Browse files Browse the repository at this point in the history
Added Docker deploy
Heroku with a Northflank database creates issues
  • Loading branch information
psonnera committed Jun 9, 2024
1 parent 098992c commit 8488a7d
Show file tree
Hide file tree
Showing 20 changed files with 287 additions and 20 deletions.
3 changes: 2 additions & 1 deletion docs/troubleshoot/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ Having a copy of your variables is very important since some of them are vital t

### Method 1 - Spreadsheet

Log into [Heroku](https://dashboard.heroku.com/apps), select your app.
Reveal your Heroku Nightscout app [Config Vars](/vendors/heroku/new_user.md#editing-config-vars-in-heroku) and copy all variables names and values in a spreadsheet.

### Method 2 - Export

Log into Heroku, select your app.
Log into [Heroku](https://dashboard.heroku.com/apps), select your app.
Click on the top right `More` button and select `Run console`.

<img src="/vendors/heroku/img/HerokuM01.png" width="300px" >
Expand Down
12 changes: 11 additions & 1 deletion docs/troubleshoot/northflank.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ orphan: true

</br>

## Site doesn't open after build

`upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: 111`

You probably need to wait until the deploy is finished. Refresh the page after 5 minutes.

</br>

## Restart

a) [Log into Northflank](https://app.northflank.com/) and select your Nightscout `project`, then its `service`.
Expand All @@ -21,4 +29,6 @@ Wait until restart is complete with the cloud status `Running`.

</br>

If your site crashes again shortly after, verify your [database is not full](/troubleshoot/atlas.md#database-full) if you use MongoDB Atlas.
If your site crashes again shortly after, verify your [database is not full](/troubleshoot/atlas.md#database-full) if you use MongoDB Atlas.

</br>
4 changes: 2 additions & 2 deletions docs/vendors/heroku/new_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Changing a variable and saving a new value will restart your site, if the change

</br>

### Prevent your Nightscout app from falling asleep
## Prevent your Nightscout app from falling asleep

```{admonition} Use with caution
:class: warning
Expand All @@ -388,7 +388,7 @@ You have completed a new Nightscout site creation. The following section provide

</br>

### Renaming your Nightscout site
## Renaming your Nightscout site

```{warning}
Starting June 14th 2023, site names will include an [application name identifier](https://devcenter.heroku.com/articles/custom-domains) after your app name.</br>
Expand Down
12 changes: 9 additions & 3 deletions docs/vendors/northflank/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Northflank offers a Mongo database.
* Simple to create
* Economic reliable database
* High quality Mongo database with a replica set
* You can deploy up to $20/mo worth of free resources on Northflank’s managed cloud
**Cons**:
* Billing starts at 0.3$ plus 0.3$ per additional GiB (it can take years to reach 1GiB for Nightscout)
* Heroku Nightscout might crash with database timeouts
```

</br>
Expand Down Expand Up @@ -125,9 +126,14 @@ d) Select `MongoDB` and type a name for your addon (not important) in `Addon nam

</br>

e) The database add-on configuration displays, scroll down.
e) Select a Mongo version if you want.

*Note: if you know what you're doing, all Mongo versions are supported by Nightscout: you can select the one you prefer.*
All Mongo versions are supported by Nightscout: you can select the one you prefer.
Since recent versions don't add value, you can safely select an older version like 5.0.24.

<img src="/vendors/northflank/img/NorthflankDB10.png" width="600px" />

</br>

**Important:** If you will use this database with a Nightscout that is not in Northflank, you must enable `Publicly accessible`.
If you will deploy Nightscout in Northflank, you can leave it disabled.
Expand Down
Binary file modified docs/vendors/northflank/img/Northflank08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/vendors/northflank/img/Northflank09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank33.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank34.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank35.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank37.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank38.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank39.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/Northflank40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/vendors/northflank/img/NorthflankDB10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion docs/vendors/northflank/migrate_a.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
orphan: true
---

```{warning}
**If you already have a Northflank database, you cannot use this wizard.**
[Create a new Northflank Nightscout site](/vendors/northflank/new_user.md#step-3-deploy-nightscout-in-northflank) with only `MONGODB_URI` and `API_SECRET` then [manually copy your Heroku variables](/vendors/northflank/new_usermd/#copy-all-variables-from-heroku).
```

a) Go to your `Account` `Dashboard` - `Settings` and scroll down to `Import`.
Select Heroku.

Expand Down Expand Up @@ -49,7 +54,7 @@ g) Verify the branch you want to migrate, usually it's `master` unless you know

</br></br>

h) **Optional** if your Heroku wasn't on stack 22 select `heroku/builder-classic:22` unless you know why you want to use another one.
h) Select `heroku/builder-classic:22`.

<img src="/vendors/northflank/img/NorthflankM08.png" width="600px" />

Expand Down
74 changes: 68 additions & 6 deletions docs/vendors/northflank/new_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ You can create your new Northflank Nightscout site with a [MongoDB Atlas](/vendo
* Nightscout fits in the free tier
* Easy to deploy or migrate an existing site from Heroku
* Simple to use and troubleshoot
* Can use a native Northflank MongoDB database ($)
* Can use a native Northflank MongoDB database
* You can deploy up to $20/mo worth of free resources on Northflank’s managed cloud
**Cons**:
* The Nightscout address generated for your site is impossible to remember
* The Nightscout address generated for your site is virtually impossible to remember
```

</br>
Expand Down Expand Up @@ -57,10 +58,12 @@ If you don't see `MONGODB_URI` but see `MONGO_CONNECTION` (**NOT** `MONGO_COLLEC

### Step 1: Create a GitHub account and fork the Nightscout project

**Do you have a GitHub account?**

```{tab-set}
:::{tab-item} This is not necessary anymore (with a Docker image)
Continue with Step 2.
:::
:::{tab-item} I don't have a GitHub Account
### Create a GitHub account
::: {include} /vendors/github/create.md
Expand All @@ -77,6 +80,8 @@ If you don't see `MONGODB_URI` but see `MONGO_CONNECTION` (**NOT** `MONGO_COLLEC

### Step 2: Create a Northflank account

***If you already created your database in Northflank, skip to step 3.***

a) Sign-up to [Northflank](https://app.northflank.com/signup) in a new browser tab. Login with GitHub (click on the logo).

<img src="/vendors/northflank/img/Northflank00.png" width="400px" />
Expand Down Expand Up @@ -131,7 +136,12 @@ g) Enter a project name (for example nightscout) and select a region (you can ma

```{tab-set}
:::{tab-item} I want to create a brand new Nightscout
:::{tab-item} I want to create a brand new Nightscout from a Docker image (recommended)
:::{include} new_user_d.md
:::
:::{tab-item} I want to create a brand new Nightscout (old method)
:::{include} new_user_a.md
:::
Expand Down Expand Up @@ -223,4 +233,56 @@ Example:</br>

Don't forget to `Update & restart` when you're done editing.

</br>
</br>

## Copy all variables from Heroku

</br>

a) Export all your Heroku variables as explained [here](/troubleshoot/heroku.md/#method-2-export). In a file you can call `heroku.env`.

If you're currently deploying a new Northflank Nightscout site, select `Env`.

<img src="/vendors/northflank/img/Northflank36.png" width="600px" />

Continue to **c)** below.

</br>

b) If you want to modify an existing Northflank site,

Open [Northflank](https://app.northflank.com/login) and login with your username or with GitHub.

<img src="/vendors/northflank/img/Northflank30.png" width="400px" />

</br>

Select `Services ` then your Nightscout project.

<img src="/vendors/northflank/img/Northflank31.png" width="600px" />

</br>

Select `Environment` then `Env`.

<img src="/vendors/northflank/img/Northflank39.png" width="600px" />

</br>

c) Select `Import from file` then the file (`heroku.env`) you saved in **a)**.

<img src="/vendors/northflank/img/Northflank37.png" width="600px" />

Your variables should display like this:

<img src="/vendors/northflank/img/Northflank38.png" width="600px" />

</br>

d) If you're creating a new site, return to the step you were following before importing all variables from Heroku.

</br>

e) If you were importing all variables from a running Northflank Nightscout site, select `Update & restart`.

<img src="/vendors/northflank/img/Northflank40.png" width="600px" />
18 changes: 12 additions & 6 deletions docs/vendors/northflank/new_user_a.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
orphan: true
---

```{warning]
If you already created a Nightscout project (for example if you created your database in Northflank), select it now.

```
<img src="/vendors/northflank/img/Northflank32.png" width="600px" /></br>

</br>

a) Select `Add new service`.
a) Select `Add new service` or `New service`.

<img src="/vendors/northflank/img/Northflank08.png" width="400px" /></br>

</br>

b) Don't change anything and scroll down to `Service name`. Click `Suggest random name`.
b) Select `Build and deploy a Git repo`. Scroll down and put a name in `Service name` or click `Suggest random name`.

<img src="/vendors/northflank/img/Northflank09.png" width="600px" /></br>

Expand All @@ -38,6 +40,10 @@ Open `Advanced build settings` and select `heroku/builder-classic:22`.

e) Expand `Variables` and click `Add variable`.

```{tip}
If you want to copy all variables from Heroku, follow [these instructions](#copy-all-variables-from-heroku) and then continue to **m)** below.
```

<img src="/vendors/northflank/img/Northflank12.png" width="600px" /></br>

</br>
Expand Down Expand Up @@ -126,7 +132,7 @@ l) You can modify the variables values, check the [documentation](/nightscout/se

</br>

m) add a 3 to 8 letter code to your URL.
m) You can modify the 3 to 8 letter code to your URL.

<img src="/vendors/northflank/img/Northflank21.png" width="600px" /></br>

Expand All @@ -140,7 +146,7 @@ n) Scroll down and check you're using an `nf-compute-10` plan, then click: `Crea

</br>

o) You now need to add a payment method.
o) If not done before, you now need to add a payment method.

<img src="/vendors/northflank/img/Northflank23.png" width="400px" /></br>

Expand Down
Loading

0 comments on commit 8488a7d

Please sign in to comment.