wasp/examples/waspleau
Anthony Suárez 0cde880f24
Feat: Validate wasp version from spec (#786)
* Add wasp field to AppSpec.App

* Validate app.wasp.version in AppSpec.Valid

* Add app.wasp.version field on .wasp file generated by CreateNewProject

* Add app.wasp.version to .wasp files of e2e tests

* Add app.wasp.version to examples' .wasp files

* Add app.wasp.version to docs

* Change waspc version from 0.6.0.0 to 0.6.0

* Change app.wasp.version validation to use regular semver

* Format code

* Refactor app.wasp.version validation

* Refactor app.wasp.version validation

* Update supported app.wasp.version format in docs

* Add TODO to validateWaspVersion

* Refactor app.wasp.version using toEnum

* Create Wasp.Version module with waspVersion constant

* Fix parseWaspVersionRange regex

Fixed:
  - The regex wasn't checking the string *starts* with ^.
  - The . symbols were not escaped.
  - The $ token is not specified as supported in the regex-tdfa docs.
    \' is used instead.

* Add comment explaining wasp version validation restrictions

* Use Wasp.Version.waspVersion instead of Paths_wasp.version
2022-10-31 23:00:03 +01:00
..
ext Jobs callback function updates (#676) 2022-08-17 13:53:05 -04:00
migrations Updates Waspleau with Jobs and some documentation updates (#600) 2022-05-25 12:55:54 -04:00
.gitignore Basic MVP of Waspleau example (#412) 2021-12-22 10:06:39 -05:00
.wasproot Basic MVP of Waspleau example (#412) 2021-12-22 10:06:39 -05:00
main.wasp Feat: Validate wasp version from spec (#786) 2022-10-31 23:00:03 +01:00
Notes.md Renames auth method EmailAndPassword to UsernameAndPassword (#696) 2022-08-24 10:32:46 -04:00
README.md Updates Waspleau with Jobs and some documentation updates (#600) 2022-05-25 12:55:54 -04:00

Waspleau

Welcome to the Waspleau example! This is a small Wasp project that will allow you to setup an easy Dashboard that pulls in data via Jobs and stores them in the database.

Step 1

Clone this repo

Step 2

Update ext/workers with whatever you want to track, add them to main.wasp as a job, and optionally import and use them in serverSetup.js (or other server-side code).

Step 3 (with PostgreSQL running)

NODE_ENV=development DATABASE_URL="postgresql://postgres@localhost/waspleau-dev" wasp db migrate-dev

Step 4

NODE_ENV=development DATABASE_URL="postgresql://postgres@localhost/waspleau-dev" wasp start

This will start your background workers as Wasp Jobs and present a dashboard UI that will auto-refresh every minute.

Note: As you develop your own workers, keep in mind each time you save a file in the project it will automatically reload everything, including restarting your server, which may re-submit or terminate running jobs.

Heroku Deployment Note

If you wish to deploy this on Heroku, pg-boss will fail to initialize as for some reason the pg client does not attempt to connect over SSL by default. This results in an error like:

pg-boss failed to start!
2022-05-18T19:07:37.464126+00:00 app[web.1]: error: no pg_hba.conf entry for host "***", user "***", database "***", SSL off

Ref: https://help.heroku.com/DR0TTWWD/seeing-fatal-no-pg_hba-conf-entry-errors-in-postgres

Even if you force SSL, it will still fail as Heroku uses a self-signed certificate. The solution is to set a PG_BOSS_NEW_OPTIONS environment variable to something like this:

{"connectionString":"<your-heroku-DATABASE_URL>","ssl":{"rejectUnauthorized":false}}

Ref: https://devcenter.heroku.com/articles/connecting-heroku-postgres#connecting-in-node-js