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',
|
dbUri: 'POSTGRES_URL',
|
||||||
},
|
},
|
||||||
skipReadme: true,
|
skipReadme: true,
|
||||||
|
skipDockerCompose: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'payload-postgres-template',
|
name: 'payload-postgres-template',
|
||||||
|
|||||||
@@ -35,14 +35,25 @@ After you click the `Deploy` button above, you'll want to have standalone copy o
|
|||||||
### Development
|
### Development
|
||||||
|
|
||||||
1. First [clone the repo](#clone) if you have not done so already
|
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.
|
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.
|
||||||
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
|
|
||||||
|
|
||||||
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.
|
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
|
## How it works
|
||||||
|
|
||||||
The Payload config is tailored specifically to the needs of most websites. It is pre-configured in the following ways:
|
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'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
payload:
|
postgres:
|
||||||
image: node:18-alpine
|
image: postgres
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- '54320:5432'
|
||||||
volumes:
|
environment:
|
||||||
- .:/home/node/app
|
POSTGRES_USER: postgres
|
||||||
- node_modules:/home/node/app/node_modules
|
POSTGRES_DB: payloadtests # THIS MUST MATCH YOUR DB NAME IN .env
|
||||||
working_dir: /home/node/app/
|
POSTGRES_HOST_AUTH_METHOD: trust
|
||||||
command: sh -c "yarn install && yarn dev"
|
|
||||||
depends_on:
|
|
||||||
- mongo
|
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
|
||||||
mongo:
|
|
||||||
image: mongo:latest
|
|
||||||
ports:
|
|
||||||
- '27017:27017'
|
|
||||||
command:
|
|
||||||
- --storageEngine=wiredTiger
|
|
||||||
volumes:
|
|
||||||
- data:/data/db
|
|
||||||
logging:
|
|
||||||
driver: none
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
data:
|
|
||||||
node_modules:
|
|
||||||
|
|||||||
@@ -805,11 +805,80 @@ export interface PagesSelect<T extends boolean = true> {
|
|||||||
layout?:
|
layout?:
|
||||||
| T
|
| T
|
||||||
| {
|
| {
|
||||||
cta?: T | CallToActionBlockSelect<T>;
|
cta?:
|
||||||
content?: T | ContentBlockSelect<T>;
|
| T
|
||||||
mediaBlock?: T | MediaBlockSelect<T>;
|
| {
|
||||||
archive?: T | ArchiveBlockSelect<T>;
|
richText?: T;
|
||||||
formBlock?: T | FormBlockSelect<T>;
|
links?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
link?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
type?: T;
|
||||||
|
newTab?: T;
|
||||||
|
reference?: T;
|
||||||
|
url?: T;
|
||||||
|
label?: T;
|
||||||
|
appearance?: T;
|
||||||
|
};
|
||||||
|
id?: T;
|
||||||
|
};
|
||||||
|
id?: T;
|
||||||
|
blockName?: T;
|
||||||
|
};
|
||||||
|
content?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
columns?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
size?: T;
|
||||||
|
richText?: T;
|
||||||
|
enableLink?: T;
|
||||||
|
link?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
type?: T;
|
||||||
|
newTab?: T;
|
||||||
|
reference?: T;
|
||||||
|
url?: T;
|
||||||
|
label?: T;
|
||||||
|
appearance?: T;
|
||||||
|
};
|
||||||
|
id?: T;
|
||||||
|
};
|
||||||
|
id?: T;
|
||||||
|
blockName?: T;
|
||||||
|
};
|
||||||
|
mediaBlock?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
media?: T;
|
||||||
|
id?: T;
|
||||||
|
blockName?: T;
|
||||||
|
};
|
||||||
|
archive?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
introContent?: T;
|
||||||
|
populateBy?: T;
|
||||||
|
relationTo?: T;
|
||||||
|
categories?: T;
|
||||||
|
limit?: T;
|
||||||
|
selectedDocs?: T;
|
||||||
|
id?: T;
|
||||||
|
blockName?: T;
|
||||||
|
};
|
||||||
|
formBlock?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
form?: T;
|
||||||
|
enableIntro?: T;
|
||||||
|
introContent?: T;
|
||||||
|
id?: T;
|
||||||
|
blockName?: T;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
meta?:
|
meta?:
|
||||||
| T
|
| T
|
||||||
@@ -825,90 +894,6 @@ export interface PagesSelect<T extends boolean = true> {
|
|||||||
createdAt?: T;
|
createdAt?: T;
|
||||||
_status?: 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
|
|
||||||
| {
|
|
||||||
link?:
|
|
||||||
| T
|
|
||||||
| {
|
|
||||||
type?: T;
|
|
||||||
newTab?: T;
|
|
||||||
reference?: T;
|
|
||||||
url?: T;
|
|
||||||
label?: T;
|
|
||||||
appearance?: T;
|
|
||||||
};
|
|
||||||
id?: T;
|
|
||||||
};
|
|
||||||
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> {
|
|
||||||
columns?:
|
|
||||||
| T
|
|
||||||
| {
|
|
||||||
size?: T;
|
|
||||||
richText?: T;
|
|
||||||
enableLink?: T;
|
|
||||||
link?:
|
|
||||||
| T
|
|
||||||
| {
|
|
||||||
type?: T;
|
|
||||||
newTab?: T;
|
|
||||||
reference?: T;
|
|
||||||
url?: T;
|
|
||||||
label?: T;
|
|
||||||
appearance?: T;
|
|
||||||
};
|
|
||||||
id?: T;
|
|
||||||
};
|
|
||||||
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> {
|
|
||||||
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> {
|
|
||||||
introContent?: T;
|
|
||||||
populateBy?: T;
|
|
||||||
relationTo?: T;
|
|
||||||
categories?: T;
|
|
||||||
limit?: T;
|
|
||||||
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> {
|
|
||||||
form?: T;
|
|
||||||
enableIntro?: T;
|
|
||||||
introContent?: T;
|
|
||||||
id?: T;
|
|
||||||
blockName?: T;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "posts_select".
|
* via the `definition` "posts_select".
|
||||||
|
|||||||
Reference in New Issue
Block a user