Deployment
API server
The iNProve server can be deployed as a normal Docker image.
Alternatively, you can also host it on fly.io.
Fly.io
Fly.io's free plan permits hosting the necessary PostgreSQL database, as well as the server. The steps below assumes you have setup the fly CLI and is authenticated.
Setup PostgreSQL database
shellfly postgres createfly postgres createSetup server
A
fly.tomlfile is included in this repository. You may choose to copy the file. This will create an app with the namenp-inprove-serverand uses Dockerfile to build.Do not deploy first.
shellfly launch --no-deploy --dockerfile build/docker/Dockerfilefly launch --no-deploy --dockerfile build/docker/DockerfileAttach PostgreSQL database
In the command below,
np-inprove-postgresis the name of the PostgreSQL database created in step one, but you can use any name.shellfly postgres attach -a np-inprove-server np-inprove-postgresfly postgres attach -a np-inprove-server np-inprove-postgresSetup secrets
By default, the precompiled binary supports either SQLite or PostgreSQL as the database driver.
In the provided
fly.tomlconfiguration file, the driver is set topostgres.You may override this using the
INPROVE_DATABASE_DRIVERNAMEenvironment variable.shellfly secrets set INPROVE_APP_JWTALGORITHM="HS256" INPROVE_APP_JWTSIGNKEY="verysecure" INPROVE_DATABASE_DATASOURCENAME="host=<host> port=<port> user=<user> dbname=<database> password=<pass> sslmode=disable"fly secrets set INPROVE_APP_JWTALGORITHM="HS256" INPROVE_APP_JWTSIGNKEY="verysecure" INPROVE_DATABASE_DATASOURCENAME="host=<host> port=<port> user=<user> dbname=<database> password=<pass> sslmode=disable"Deploy!
Deploy the server!
shellfly launchfly launch
Frontend server
The frontend server can be deployed as a normal Docker image.
Alternatively, you can also host it on any of the platforms supported by Nuxt (see here).
The preferred hosting platform is with Cloudflare Pages, as it supports all features on its free plan.
Cloudflare Pages
Configure a new Pages project using the settings below:
| Configuration | Value |
|---|---|
| Build command | npx pnpm i --store=node_modules/.pnpm-store && npm run build |
| Build output directory | /dist |
Also, add the following environment variables:
| Environment variable | Value |
|---|---|
NODE_VERSION | 16 |
NPM_FLAGS | --version |
NUXT_PUBLIC_API_URL | Your API URL |