Skip to content

Commit 4ec2b17

Browse files
committed
Update info about Fly.io pricing and some other updates to part 3b
1 parent 9d6d143 commit 4ec2b17

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

src/content/3/en/part3b.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ There is an ever-growing number of services that can be used to host an app on t
9393

9494
For a decade, [Heroku](http://heroku.com) was dominating the PaaS scene. Unfortunately the free tier Heroku ended at 27th November 2022. This is very unfortunate for many developers, especially students. Heroku is still very much a viable option if you are willing to spend some money. They also have [a student program](https://www.heroku.com/students) that provides some free credits.
9595

96-
We are now introducing two services [Fly.io](https://fly.io/) and [Render](https://render.com/) that both have a (limited) free plan. Fly.io is our "official" hosting service since it can be for sure used also on parts 11 and 13 of the course. Render will be fine at least for the other parts of this course.
97-
98-
Note that despite using the free tier only, Fly.io <i>might</i> require one to enter their credit card details. At the moment Render can be used without a credit card.
99-
100-
Render might be a bit easier to use since it does not require any software to be installed on your machine.
96+
We are now introducing two services [Fly.io](https://fly.io/) and [Render](https://render.com/). Fly.io offers more flexibility as a service, but it has also recently become paid. Render offers some free compute time, so if you want to complete the course without costs, choose Render. Setting up Render might also be easier in some cases, as Render does not require any installations on your own machine.
10197

10298
There are also some other free hosting options that work well for this course, at least for all parts other than part 11 (CI/CD) which might have one tricky exercise for other platforms.
10399

@@ -106,7 +102,7 @@ Some course participants have also used the following services:
106102
- [Replit](https://replit.com)
107103
- [CodeSandBox](https://codesandbox.io)
108104

109-
If you know some other good and easy-to-use services for hosting NodeJS, please let us know!
105+
If you know easy-to-use and free services for hosting NodeJS, please let us know!
110106

111107
For both Fly.io and Render, we need to change the definition of the port our application uses at the bottom of the <i>index.js</i> file in the backend like so:
112108

@@ -117,13 +113,11 @@ app.listen(PORT, () => {
117113
})
118114
```
119115

120-
Now we are using the port defined in the [environment variable](https://en.wikipedia.org/wiki/Environment_variable) _PORT_ or port 3001 if the environment variable _PORT_ is undefined. Fly.io and Render configure the application port based on that environment variable.
116+
Now we are using the port defined in the [environment variable](https://en.wikipedia.org/wiki/Environment_variable) _PORT_ or port 3001 if the environment variable _PORT_ is undefined. It is possible to configure the application port based on the environment variable both in Fly.io and in Render.
121117

122118
#### Fly.io
123119

124-
<i>Note that you may need to give your credit card number to Fly.io even if you are using only the free tier!</i> There has been actually conflicting reports about this, it is known for a fact that some of the students in this course are using Fly.io without entering their credit card info. At the moment [Render](https://render.com/) can be used without a credit card.
125-
126-
By default, everyone gets two free virtual machines that can be used for running two apps at the same time.
120+
<i>Note that you may need to give your credit card number to Fly.io!</i>
127121

128122
If you decide to use [Fly.io](https://fly.io/) begin by installing their flyctl executable following [this guide](https://fly.io/docs/hands-on/install-flyctl/). After that, you should [create a Fly.io account](https://fly.io/docs/hands-on/sign-up/).
129123

@@ -350,21 +344,20 @@ Unlike when running the app in a development environment, everything is now in t
350344
351345
### The whole app to the internet
352346
353-
After ensuring that the production version of the application works locally, commit the production build of the frontend to the backend repository, and push the code to GitHub again.
354-
355-
**NB** If you use Render, make sure the directory <i>dist</i> is not ignored by git on the backend.
356-
357-
If you are using Render a push to GitHub <i>might</i> be enough. If the automatic deployment does not work, select the "manual deploy" from the Render dashboard.
347+
After ensuring that the production version of the application works locally, we are ready to move the whole application to the selected host service.
358348
359-
In the case of Fly.io the new deployment is done with the command
349+
<strong>In the case of Fly.io</strong> the new deployment is done with the command
360350
361351
```bash
362352
fly deploy
363353
```
354+
<strong>NOTE:</strong> The _.dockerignore_ file in your project directory lists files not uploaded during deployment. The dist directory may be included by default. If that's the case, remove its reference from the .dockerignore file, ensuring your app is properly deployed.
355+
356+
357+
<strong>In the case of Render</strong>, commit the production build of the frontend to the backend repository, and push the code to GitHub again. Make sure the directory <i>dist</i> is not ignored by git on the backend. A push to GitHub <i>might</i> be enough. If the automatic deployment does not work, select the "manual deploy" from the Render dashboard.
364358
365359
The application works perfectly, except we haven't added the functionality for changing the importance of a note to the backend yet.
366360
367-
<strong>NOTE:</strong> When using Fly.io, be aware that the _.dockerignore_ file in your project directory lists files not uploaded during deployment. The dist directory is included by default. To deploy this directory, remove its reference from the .dockerignore file, ensuring your app is properly deployed.
368361
369362
![screenshot of notes application](../../images/3/30new.png)
370363

src/content/3/fi/osa3b.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,16 @@ Sovellusten hostaamiseen, eli "internettiin laittamiseen" on olemassa lukematon
7575

7676
Kymmenen vuoden ajan PaaS-ratkaisujen ykkönen on ollut [Heroku](http://heroku.com). Elokuun 2022 lopussa Heroku ilmoitti että 27.11.2022 alkaen alustan maksuttomat palvelut loppuvat. Jos olet valmis maksamaan hiukan, on Heroku edelleen varteenotettava vaihtoehto.
7777

78-
Esittelemme seuraavassa kaksi hieman uudempaa palvelua [Fly.io:n](https://fly.io/):n sekä [Renderin](https://render.com/). Molemmilla on tarjolla jonkin verran ilmaista laskenta-aikaa.
78+
Esittelemme seuraavassa kaksi hieman uudempaa palvelua [Fly.io:n](https://fly.io/):n sekä [Renderin](https://render.com/). Fly.io tarjoaa palveluna enemmän joustavuutta, mutta myös se on muuttunut hiljattain maksulliseksi. Renderissä on tarjolla jonkin verran ilmaista laskenta-aikaa, joten jos haluat suorittaa kurssin ilman kuluja, valitse Render. Renderin käyttöönotto saattaa myös olla jossain tapauksissa helpompaa, sillä Render ei edellytä mitään asennuksia omalle koneelle.
7979

80-
Hienoinen ikävä puoli Fly.io:ssa on se, että <i>saatat</i> joutua kertomaan palvelulle luottokorttitietosi vaikka <i>et käytä</i> palvelun maksullista osaa. Renderin käyttöönotto saattaa olla jossain tapauksissa helpompaa, sillä Render ei edellytä mitään asennuksia omalle koneelle.
80+
On olemassa myös muita palveluja, jotka saattavat toimia hyvin tämän kurssin kanssa, ainakin kaikissa muissa osissa paitsi osassa 11 (CI/CD), jossa saattaa olla yksi hankala harjoitus muille alustoille.
81+
82+
Jotkut kurssin osallistujat ovat käyttäneet seuraavia palveluita:
83+
84+
- [Replit](https://replit.com)
85+
- [CodeSandBox](https://codesandbox.io)
86+
87+
Jos tiedät helppokäyttöisiä ja ilmaisia palveluita NodeJS:n hostaamiseen, kerro siitä meille!
8188

8289
Molempia ratkaisuja varten muutetaan tiedoston <i>index.js</i> lopussa olevaa sovelluksen käyttämän portin määrittelyä seuraavasti:
8390

@@ -88,14 +95,13 @@ app.listen(PORT, () => {
8895
})
8996
```
9097

91-
Nyt käyttöön tulee [ympäristömuuttujassa](https://en.wikipedia.org/wiki/Environment_variable) _PORT_ määritelty portti tai 3001, jos ympäristömuuttuja _PORT_ ei ole määritelty. Sekä Fly.io että Render konfiguroivat sovelluksen portin ympäristömuuttujan avulla.
98+
Nyt käyttöön tulee [ympäristömuuttujassa](https://en.wikipedia.org/wiki/Environment_variable) _PORT_ määritelty portti tai 3001, jos ympäristömuuttuja _PORT_ ei ole määritelty. Sekä Fly.io:ssa että Renderissä sovelluksen portti on mahdollista konfiguroida ympäristömuuttujan avulla.
9299

93100
#### Fly.io
101+
<i>Huomaa, että sinun tulee mahdollisesti syöttää Fly.io:hon maksukorttisi numero, ja palvelun käytöstä veloitetaan hinnaston mukaisesti, jos erillistä ilmaista kokeilua ei ole tarjolla.</i>
94102

95103
Jos päätät käyttää [Fly.io](https://fly.io/):ta, aloita asentamalla Fly.io [tämän](https://fly.io/docs/hands-on/install-flyctl/) ohjeen mukaan ja luomalla itsellesi [tunnus](https://fly.io/docs/hands-on/sign-up/) palveluun.
96104

97-
Oletusarvoisesti saat käyttöösi kaksi ilmaista virtuaalikonetta, ja pystyt käynnistämään molempiin yhden sovelluksen.
98-
99105
Aloita [kirjautumalla](https://fly.io/docs/hands-on/sign-in/) komentoriviltä palveluun komennolla
100106

101107
```bash
@@ -107,7 +113,7 @@ fly auth login
107113
Sovelluksen alustus tapahtuu seuraavasti. Mene sovelluksen juurihakemistoon ja anna komento
108114

109115
```bash
110-
fly launch
116+
fly launch --no-deploy
111117
```
112118

113119
Anna sovellukselle nimi, tai anna Fly.io:n generoida automaattinen nimi, valitse "region" eli alue, jonka konesalissa sovelluksesi toimii. Älä luo sovellukselle postgres- sekä Upstash Redis-tietokantaa. Lopuksi vielä kysytään "Would you like to deploy now?" eli haluatko että sovellus myös viedään tuotantoympäristöön. Valitse "Ei".
@@ -294,14 +300,18 @@ Toisin kuin sovelluskehitysympäristössä, kaikki sovelluksen tarvitsema löyty
294300
295301
### Koko sovellus Internetiin
296302
297-
Kun sovelluksen "Internetiin vietävä" tuotantoversio todetaan toimivaksi paikallisesti, commitoidaan frontendin tuotantoversio backendin repositorioon ja pushataan koodi GitHubiin. Jos käytät Renderiä, saattaa automaattinen uudelleenkäynnistys toimia. Jos näin ei ole, käynnistä uusi versio itse dashboardin kautta tekemällä "manual deployment".
303+
Kun sovelluksen "Internetiin vietävä" tuotantoversio todetaan toimivaksi paikallisesti, voidaan koko sovellus siirtää suoritettavaksi valittuun palveluun.
298304
299-
Fly.io:n tapauksessa sovelluksen uusi versio käynnistyy komennolla
305+
<strong>Fly.io:n tapauksessa</strong> sovelluksen uusi versio käynnistyy komennolla
300306
301307
```bash
302308
fly deploy
303309
```
304310
311+
<strong>HUOM:</strong> Projektin juureen luotu _.dockerignore_-tiedosto listaa ne tiedostot, joita ei oteta mukaan deploymentiin, ja dist-kansio saattaa olla siellä mukana oletuksena. Jos näin on, poista viittaus dist/ _.dockerignore_-tiedostosta, jotta sovelluksesi otetaan käyttöön oikein.
312+
313+
<strong>Renderin tapauksessa</strong> commitoidaan frontendin tuotantoversio backendin repositorioon ja pushataan koodi GitHubiin. Automaattinen uudelleenkäynnistys saattaa toimia, mutta jos näin ei ole, käynnistä uusi versio itse dashboardin kautta tekemällä "manual deployment".
314+
305315
Sovellus toimii moitteettomasti lukuun ottamatta vielä backendiin toteuttamatonta muistiinpanon tärkeyden muuttamista:
306316
307317
![Selain renderöi sovelluksen frontendin (joka näyttää palvelimella olevan datan) mentäessä sovelluksen heroku-urlin juureen](../../images/3/30new.png)

0 commit comments

Comments
 (0)