templates: document local development (#10032)
Provide docker-compose for spinning up postgres locally along w/ relevant info in README.
This commit is contained in:
@@ -104,6 +104,7 @@ async function main() {
|
||||
dbUri: 'POSTGRES_URL',
|
||||
},
|
||||
skipReadme: true,
|
||||
skipDockerCompose: true,
|
||||
},
|
||||
{
|
||||
name: 'payload-postgres-template',
|
||||
|
||||
@@ -35,14 +35,25 @@ After you click the `Deploy` button above, you'll want to have standalone copy o
|
||||
### Development
|
||||
|
||||
1. First [clone the repo](#clone) if you have not done so already
|
||||
1. `cd my-project && cp .env.example .env` to copy the example environment variables. You'll need to add the `POSTGRES_URL` and `BLOB_READ_WRITE_TOKEN` from your Vercel project to your `.env` if you want to use Vercel Blob and the Neon database that was created for you.
|
||||
1. `pnpm install && pnpm dev` to install dependencies and start the dev server
|
||||
1. open `http://localhost:3000` to open the app in your browser
|
||||
2. `cd my-project && cp .env.example .env` to copy the example environment variables. You'll need to add the `POSTGRES_URL` and `BLOB_READ_WRITE_TOKEN` from your Vercel project to your `.env` if you want to use Vercel Blob and the Neon database that was created for you.
|
||||
|
||||
You might
|
||||
> _NOTE: If the connection string value includes `localhost` or `127.0.0.1`, the code will automatically use a normal postgres adapter instead of Vercel._. You can override this functionality by setting `forceUseVercelPostgres: true` if desired.
|
||||
|
||||
3. `pnpm install && pnpm dev` to install dependencies and start the dev server
|
||||
4. open `http://localhost:3000` to open the app in your browser
|
||||
|
||||
That's it! Changes made in `./src` will be reflected in your app. Follow the on-screen instructions to login and create your first admin user. Then check out [Production](#production) once you're ready to build and serve your app, and [Deployment](#deployment) when you're ready to go live.
|
||||
|
||||
#### Docker (Optional)
|
||||
|
||||
If you prefer to use Docker for local development instead of a local Postgres instance, the provided docker-compose.yml file can be used.
|
||||
|
||||
To do so, follow these steps:
|
||||
|
||||
- Modify the `POSTGRES_URL` in your `.env` file to `postgres://postgres@postgres:54320/<dbname>`
|
||||
- Modify the `docker-compose.yml` file's `POSTGRES_DB` to match the above `<dbname>`
|
||||
- Run `docker-compose up` to start the database, optionally pass `-d` to run in the background.
|
||||
|
||||
## How it works
|
||||
|
||||
The Payload config is tailored specifically to the needs of most websites. It is pre-configured in the following ways:
|
||||
|
||||
@@ -1,31 +1,13 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
payload:
|
||||
image: node:18-alpine
|
||||
postgres:
|
||||
image: postgres
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- .:/home/node/app
|
||||
- node_modules:/home/node/app/node_modules
|
||||
working_dir: /home/node/app/
|
||||
command: sh -c "yarn install && yarn dev"
|
||||
depends_on:
|
||||
- mongo
|
||||
- '54320:5432'
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: payloadtests # THIS MUST MATCH YOUR DB NAME IN .env
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
mongo:
|
||||
image: mongo:latest
|
||||
ports:
|
||||
- '27017:27017'
|
||||
command:
|
||||
- --storageEngine=wiredTiger
|
||||
volumes:
|
||||
- data:/data/db
|
||||
logging:
|
||||
driver: none
|
||||
|
||||
volumes:
|
||||
data:
|
||||
node_modules:
|
||||
|
||||
@@ -805,31 +805,9 @@ export interface PagesSelect<T extends boolean = true> {
|
||||
layout?:
|
||||
| T
|
||||
| {
|
||||
cta?: T | CallToActionBlockSelect<T>;
|
||||
content?: T | ContentBlockSelect<T>;
|
||||
mediaBlock?: T | MediaBlockSelect<T>;
|
||||
archive?: T | ArchiveBlockSelect<T>;
|
||||
formBlock?: T | FormBlockSelect<T>;
|
||||
};
|
||||
meta?:
|
||||
cta?:
|
||||
| T
|
||||
| {
|
||||
title?: T;
|
||||
image?: T;
|
||||
description?: T;
|
||||
};
|
||||
publishedAt?: T;
|
||||
slug?: T;
|
||||
slugLock?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
_status?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "CallToActionBlock_select".
|
||||
*/
|
||||
export interface CallToActionBlockSelect<T extends boolean = true> {
|
||||
richText?: T;
|
||||
links?:
|
||||
| T
|
||||
@@ -848,12 +826,10 @@ export interface CallToActionBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "ContentBlock_select".
|
||||
*/
|
||||
export interface ContentBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
content?:
|
||||
| T
|
||||
| {
|
||||
columns?:
|
||||
| T
|
||||
| {
|
||||
@@ -874,21 +850,17 @@ export interface ContentBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "MediaBlock_select".
|
||||
*/
|
||||
export interface MediaBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
mediaBlock?:
|
||||
| T
|
||||
| {
|
||||
media?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "ArchiveBlock_select".
|
||||
*/
|
||||
export interface ArchiveBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
archive?:
|
||||
| T
|
||||
| {
|
||||
introContent?: T;
|
||||
populateBy?: T;
|
||||
relationTo?: T;
|
||||
@@ -897,17 +869,30 @@ export interface ArchiveBlockSelect<T extends boolean = true> {
|
||||
selectedDocs?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "FormBlock_select".
|
||||
*/
|
||||
export interface FormBlockSelect<T extends boolean = true> {
|
||||
};
|
||||
formBlock?:
|
||||
| T
|
||||
| {
|
||||
form?: T;
|
||||
enableIntro?: T;
|
||||
introContent?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
meta?:
|
||||
| T
|
||||
| {
|
||||
title?: T;
|
||||
image?: T;
|
||||
description?: T;
|
||||
};
|
||||
publishedAt?: T;
|
||||
slug?: T;
|
||||
slugLock?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
_status?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
|
||||
Reference in New Issue
Block a user