Skip to content

Commit

Permalink
renamed NEXT_PUBLIC_URL as this var get internally renamed by nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
toggm committed Jan 28, 2025
1 parent 0711bf9 commit 4d9c8f2
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PRINTER_SECRET=secret

# Configure for you public deployment, defaults to http://localhost:3000
# Doesn't work with gotenbergs demo instance if not pointing to a public visible url
NEXT_PUBLIC_URL=http://localhost:3000
PUBLIC_URL=http://localhost:3000

# -- Optional configuration

Expand Down
28 changes: 0 additions & 28 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,3 @@
This directory provide basic docker compose configurations to setup and start a cv-manager instance. Please adapt configurations to your needs.
Next to the docker compose file, a default `.env` file is provided. Please read in the [configuration section](https://github.com/tegonal/cv-manager/blob/main/README.md#Configuration) how to adapt those properties.

### Postgres
Ready to use setup with postgres database adapter and starting the following docker images:
* caddy as proxy server with self-signed certificates
* postgres
* gotenberg
* pgadmin (optional)
* pgbackup (optional)
* cv-manager

#### Secrets
Adjust at least the following secrets in the `.env` file to ensure you're running the instance with your own secrets:
* `PAYLOAD_SECRET`
* `PRINTER_SECRET`
* `S3_SECRET_ACCESS_KEY`
* `S3_ACCESS_KEY_ID`
* `MINIO_ROOT_PASSWORD`

#### Accessible URL
Adjust the `NEXT_PUBLIC_URL` to the URL under which the instance should be accessible and define the same hostname in the `Caddyfile` configuration.

### Run the application
Start the docker image in the desired directory:
```
docker compose up -f
```

Access

2 changes: 1 addition & 1 deletion docker-compose/mongodb/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PRINTER_SECRET=secret

# Configure for you public deployment, defaults to http://localhost:3000
# Doesn't work with gotenbergs demo instance if not pointing to a public visible url
NEXT_PUBLIC_URL=http://localhost:3000
PUBLIC_URL=http://localhost:3000

# -- Optional configuration

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/postgres/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PRINTER_SECRET=secret

# Configure for you public deployment, defaults to http://localhost:3000
# Doesn't work with gotenbergs demo instance if not pointing to a public visible url
NEXT_PUBLIC_URL=https://localhost
PUBLIC_URL=https://localhost

# -- Optional configuration

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/postgres/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Replace with the hostname of NEXT_PUBLIC_URL
# Replace with the hostname of PUBLIC_URL
localhost {
reverse_proxy app:3000
}
Expand Down
31 changes: 31 additions & 0 deletions docker-compose/postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### CV-Manager with Postgres backend
Ready to use setup with postgres database adapter and starting the following docker images:
* caddy as proxy server with self-signed certificates
* postgres
* gotenberg
* pgadmin (optional)
* pgbackup (optional)
* cv-manager

#### Secrets
Adjust at least the following secrets in the `.env` file to ensure you're running the instance with your own secrets:
* `PAYLOAD_SECRET`
* `PRINTER_SECRET`
* `S3_SECRET_ACCESS_KEY`
* `S3_ACCESS_KEY_ID`
* `MINIO_ROOT_PASSWORD`

#### Accessible URL
Adjust the `PUBLIC_URL` to the URL under which the instance should be accessible and define the same hostname in the `Caddyfile` configuration.

### Run the application
Start the docker image in the desired directory:
```
docker compose up -f
```
Open https://localhost or the provided `PUBLIC_URL` in your browser and log-in with the default credentials:

* Username: [email protected]
* Password: admin

⚠️ Please change the use account as soon as possible.
2 changes: 1 addition & 1 deletion docker-compose/sqlite/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PRINTER_SECRET=secret

# Configure for you public deployment, defaults to http://localhost:3000
# Doesn't work with gotenbergs demo instance if not pointing to a public visible url
NEXT_PUBLIC_URL=http://localhost:3000
PUBLIC_URL=http://localhost:3000

# -- Optional configuration

Expand Down
6 changes: 3 additions & 3 deletions payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const determineDatabase = (url?: string) => {
}
};

console.error('Starting server with serverUrl '+process.env.NEXT_PUBLIC_URL)
console.error('Starting server with serverUrl '+process.env.PUBLIC_URL)

export default buildConfig({
editor: lexicalEditor(),
Expand Down Expand Up @@ -143,7 +143,7 @@ export default buildConfig({
titleSuffix: '- CV Manager',
},
},
serverURL: process.env.NEXT_PUBLIC_URL || 'http://localhost:3000',
serverURL: process.env.PUBLIC_URL || 'http://localhost:3000',
email: process.env.SMTP_HOST
? nodemailerAdapter({
defaultFromAddress: process.env.SMTP_FROM_ADDRESS || '',
Expand Down Expand Up @@ -188,7 +188,7 @@ export default buildConfig({
strategyName: 'oauth2',
useEmailAsIdentity: false,
enabled: process.env.OAUTH_CLIENT_ID !== undefined,
serverURL: process.env.NEXT_PUBLIC_URL || 'http://localhost:3000',
serverURL: process.env.PUBLIC_URL || 'http://localhost:3000',
authCollection: Users.slug,
clientId: process.env.OAUTH_CLIENT_ID || '',
clientSecret: process.env.OAUTH_CLIENT_SECRET || '',
Expand Down
2 changes: 1 addition & 1 deletion src/payload/plugins/cv-pdf-generator/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const requestHandler = async (
Chromiumly.configure({ endpoint: pluginConfig.gotenbergUrl });
const urlConverter = new UrlConverter();

const host = process.env.NEXT_PUBLIC_URL || 'http://host.docker.internal:3000';
const host = process.env.PUBLIC_URL || 'http://host.docker.internal:3000';

if (!host) {
throw new Error('PDF Printer: Host undefined. Aborting..');
Expand Down

0 comments on commit 4d9c8f2

Please sign in to comment.