README: expalining HOSTNAME issue
This commit is contained in:
21
README.md
21
README.md
@@ -1,6 +1,3 @@
|
|||||||
# ToDo
|
|
||||||
* year pagination
|
|
||||||
|
|
||||||
# Authentication
|
# Authentication
|
||||||
Authentication consists of the following parts:
|
Authentication consists of the following parts:
|
||||||
* `next-auth` boilerplate
|
* `next-auth` boilerplate
|
||||||
@@ -32,10 +29,20 @@ The image will be stored in the local Docker instance.
|
|||||||
## Deploying Docker service
|
## Deploying Docker service
|
||||||
Run the following command:
|
Run the following command:
|
||||||
```bash
|
```bash
|
||||||
HOSTNAME=0.0.0.0 \
|
|
||||||
NEXTAUTH_URL=https://rezije.app \
|
|
||||||
PORT=3001 \
|
|
||||||
docker stack deploy \
|
docker stack deploy \
|
||||||
-c docker-compose-deploy.yml \
|
-c docker-compose-deploy.yml \
|
||||||
utility-bills-tracker
|
utility-bills-tracker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Implementation details
|
||||||
|
## Issues with HOSTNAME
|
||||||
|
When deplyed via docker and published via Cloudflare there's an issue with `HOSTNAME` env variable:
|
||||||
|
* if left unset, the server will use IP address assigned to container by Docker and **will not accept connections from outside**
|
||||||
|
* if set to "0.0.0.0" the server will serve static pages, but will *reject API calls when submitting form*
|
||||||
|
* if set to "rezije.app" the server will not start since the IP address it resolves with the given FQDN does not match any of the IP addresses assigned to the container
|
||||||
|
|
||||||
|
So there are the following issues:
|
||||||
|
* server will not accept external request - can be fixed by setting `HOSTNAME` to `0.0.0.0`
|
||||||
|
* server rejects API requests - can be fixed by adding `serverActions.allowedOrigins` option to `nextjs.config.js` file
|
||||||
|
|
||||||
|
So these are the fixes which were implemented in order to be able to run server in production.
|
||||||
Reference in New Issue
Block a user