2021-03-13 16:15:15 +02:00
|
|
|
# Blueprints application
|
2020-10-22 15:53:06 +02:00
|
|
|
|
2021-03-13 16:15:15 +02:00
|
|
|
## Setting up the project
|
2020-10-22 15:53:06 +02:00
|
|
|
|
2021-03-13 16:15:15 +02:00
|
|
|
- Add a `.env.local` file to apps/blueprints/ with the following values
|
2020-10-22 15:53:06 +02:00
|
|
|
|
2021-03-13 16:15:15 +02:00
|
|
|
```
|
|
|
|
POSTGRES_DB=factorio-blueprints
|
|
|
|
POSTGRES_USER=factorio-blueprints
|
|
|
|
#POSTGRES_HOST=127.0.0.1
|
|
|
|
#POSTGRES_PASSWORD=local
|
|
|
|
STEAM_WEB_API_KEY=(optional, for steam login)
|
|
|
|
GOOGLE_APPLICATION_CREDENTIALS="full/path/to/json-key-file.json"
|
|
|
|
GCP_BLUEPRINT_STRINGS_BUCKET=blueprint-strings
|
|
|
|
GCP_BLUEPRINT_IMAGES_BUCKET=blueprint-images
|
|
|
|
```
|
2020-10-22 15:53:06 +02:00
|
|
|
|
2021-03-13 16:15:15 +02:00
|
|
|
- Add a `.env` file to apps/blueprints/prisma with a database connection url like
|
2020-10-22 15:53:06 +02:00
|
|
|
|
2021-03-13 16:15:15 +02:00
|
|
|
```
|
|
|
|
DATABASE_URL="postgresql://factorio-blueprints:local@127.0.0.1:5432/factorio-blueprints"
|
|
|
|
```
|
|
|
|
|
|
|
|
- Run DB migration
|
2021-01-07 15:09:56 +02:00
|
|
|
|
|
|
|
```
|
2021-03-13 16:15:15 +02:00
|
|
|
cd apps/blueprints && npx prisma migrate deploy --preview-feature
|
2021-01-07 15:09:56 +02:00
|
|
|
```
|
2021-03-13 16:15:15 +02:00
|
|
|
|
|
|
|
- Run local app
|
|
|
|
|
|
|
|
```
|
|
|
|
nx serve
|
|
|
|
```
|
|
|
|
|
|
|
|
## Deploying
|
|
|
|
|
|
|
|
- `docker build -t eu.gcr.io/factorio-sites/blueprints --file blueprints.Dockerfile .`
|
|
|
|
- `docker tag eu.gcr.io/factorio-sites/blueprints eu.gcr.io/factorio-sites/blueprints:dev`
|
|
|
|
- `docker push eu.gcr.io/factorio-sites/blueprints`
|
2021-03-29 00:11:42 +02:00
|
|
|
|
|
|
|
## Google cloud environment
|
|
|
|
|
|
|
|
If deploying nextjs assets to google storage, set cors options
|
|
|
|
gsutil cors set ./gcp-storage-cors.json gs://bucket_name
|