mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-27 14:55:20 +03:00
Touched-up deployment and related instructions. (#651)
This commit is contained in:
parent
11da82705d
commit
ec032e74e6
@ -51,7 +51,7 @@ genPrismaSchema spec = do
|
||||
AS.Db.PostgreSQL -> return ("postgresql", "env(\"DATABASE_URL\")")
|
||||
AS.Db.SQLite ->
|
||||
if AS.isBuild spec
|
||||
then logAndThrowGeneratorError $ GenericGeneratorError "SQLite (a default database) is not supported in production. To build your Wasp app for production, switch to a different database. Switching to PostgreSQL: https://wasp-lang.dev/docs/language/features/#migrating-from-sqlite-to-postgresql ."
|
||||
then logAndThrowGeneratorError $ GenericGeneratorError "SQLite (a default database) is not supported in production. To build your Wasp app for production, switch to a different database. Switching to PostgreSQL: https://wasp-lang.dev/docs/language/features#migrating-from-sqlite-to-postgresql ."
|
||||
else return ("sqlite", "\"file:./dev.db\"")
|
||||
|
||||
let templateData =
|
||||
|
@ -134,4 +134,6 @@ While positioned in `.wasp/build/web-app/` directory, and after you have created
|
||||
```
|
||||
netlify deploy
|
||||
```
|
||||
and that is it!
|
||||
and carefully follow their instructions (i.e. do you want to create a new app or use existing one, team under which your app will reside, ..., final step to run `netlify deploy --prod`).
|
||||
|
||||
That is it!
|
||||
|
@ -1110,22 +1110,26 @@ Default database is `SQLite`, since it is great for getting started with a new p
|
||||
Check below for more details on how to migrate from SQLite to PostgreSQL.
|
||||
|
||||
### PostgreSQL
|
||||
When using `PostgreSQL` (`db: { system: PostgreSQL }`), you will need to spin up a postgres database on your own so it runs during development (when running `wasp start` or doing `wasp db ...` commands) and provide Wasp with `DATABASE_URL` environment variable that Wasp will use to connect to it.
|
||||
When using `PostgreSQL` as your database (`app: { db: { system: PostgreSQL } }`), you will need to spin up a postgres database on your own so it runs during development (when running `wasp start` or doing `wasp db ...` commands) and you will need to provide Wasp with `DATABASE_URL` environment variable that Wasp will use to connect to it.
|
||||
|
||||
One of the easiest ways to do this is by spinning up postgres docker container when you need it with the shell command
|
||||
One of the easiest ways to run a PostgreSQL database on your own is by spinning up [postgres docker](https://hub.docker.com/_/postgres) container when you need it with the following shell command:
|
||||
```
|
||||
docker run \
|
||||
--rm \
|
||||
--publish 5432:5432 \
|
||||
-v postgresql-data:/var/lib/postgresql/data \
|
||||
--env POSTGRES_PASSWORD=devpass \
|
||||
-v my-app-data:/var/lib/postgresql/data \
|
||||
--env POSTGRES_PASSWORD=devpass1234 \
|
||||
postgres
|
||||
```
|
||||
and adding the line
|
||||
|
||||
:::note
|
||||
The password you provide via `POSTGRES_PASSWORD` is relevant only for the first time when you run that docker command, when database is set up for the first time. Consequent runs will ignore the value of `POSTGRES_PASSWORD` and will just use the password that was initially set. This is just how postgres docker works.
|
||||
:::
|
||||
|
||||
The easiest way to provide the needed `DATABASE_URL` environment variable is by adding the following line to the [.env](https://wasp-lang.dev/docs/language/features#env) file in the root dir of your Wasp project (if that file doesn't yet exist, create it):
|
||||
```
|
||||
DATABASE_URL=postgresql://postgres:devpass@localhost:5432/postgres
|
||||
DATABASE_URL=postgresql://postgres:devpass1234@localhost:5432/postgres
|
||||
```
|
||||
to the `.env` file in the root directory of your Wasp project.
|
||||
|
||||
### Migrating from SQLite to PostgreSQL
|
||||
To run Wasp app in production, you will need to switch from `SQLite` to `PostgreSQL`.
|
||||
|
Loading…
Reference in New Issue
Block a user