Run NestJs with Docker container - docker

I use these NestJs for education GITHUB, but I can't run it from the Docker file, gives me an error.I had checked with cli inside /usr/src/app/package.json and the start:prod script was there. Where is the problem?
/usr/bin/env: 'bash\r': No such file or directory
"[37;40mnpm ERR! Missing script: "start:prod
npm ERR!
npm ERR! Did you mean this?
npm ERR! npm run start:prod # run the "start:prod" package script
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-20T12_20_18_944Z-debug-0.log

This worked just fine
docker-compose --env-file env-example -p ci up --build
.
.
.
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] UsersController {/api/users} (version: 1): +192ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/users, POST} (version: 1) route +3ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/users, GET} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/users/:id, GET} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/users/:id, PATCH} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/users/:id, DELETE} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] FilesController {/api/files} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/files/upload, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/files/:path, GET} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] AuthController {/api/auth} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/email/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/admin/email/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/email/register, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/email/confirm, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/forgot/password, POST} (version: 1) route +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/reset/password, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/me, GET} (version: 1) route +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/me, PATCH} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/me, DELETE} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] AuthFacebookController {/api/auth/facebook} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/facebook/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] AuthGoogleController {/api/auth/google} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/google/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] AuthTwitterController {/api/auth/twitter} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/twitter/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] AuthAppleController {/api/auth/apple} (version: 1): +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/api/auth/apple/login, POST} (version: 1) route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RoutesResolver] HomeController {/api}: +0ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [RouterExplorer] Mapped {/, GET} route +1ms
api_1 | [Nest] 129 - 07/21/2022, 5:38:15 AM LOG [NestApplication] Nest application successfully started +8ms

Related

Why is hot reloading not working in my NestJS/Docker-Compose multistage project?

Hot reloading is not working. The API is not being updated after changes in the code are saved. Here is the code:
https://codesandbox.io/s/practical-snowflake-c4j6fh
When bulding (docker-compose up -V --build) I get the following messages on terminal:
2022-12-16 09:29:53 redis | 1:C 16 Dec 2022 12:29:53.411 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo</br>2022-12-16 09:29:53 redis | 1:C 16 Dec 2022 12:29:53.411 # Redis version=7.0.6, bits=64, commit=00000000, modified=0, pid=1, just started</br>2022-12-16 09:29:53 redis | 1:C 16 Dec 2022 12:29:53.411 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf</br>2022-12-16 09:29:53 redis | 1:M 16 Dec 2022 12:29:53.411 * monotonic clock: POSIX clock_gettime</br>2022-12-16 09:29:53 redis | 1:M 16 Dec 2022 12:29:53.411 * Running mode=standalone, port=6379.</br>2022-12-16 09:29:53 redis | 1:M 16 Dec 2022 12:29:53.411 # Server initialized</br>2022-12-16 09:29:53 redis | 1:M 16 Dec 2022 12:29:53.411 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/</br>jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.</br>2022-12-16 09:29:53 redis | 1:M 16 Dec 2022 12:29:53.412 * Ready to accept connections</br>2022-12-16 09:29:53 postgres | The files belonging to this database system will be owned by user "postgres".</br>2022-12-16 09:29:53 postgres | This user must also own the server process.</br>2022-12-16 09:29:53 postgres | </br>2022-12-16 09:29:53 postgres | The database cluster will be initialized with locale "en_US.utf8".</br>2022-12-16 09:29:53 postgres | The default database encoding has accordingly been set to "UTF8".</br>2022-12-16 09:29:53 postgres | The default text search configuration will be set to "english".</br>2022-12-16 09:29:53 postgres | </br>2022-12-16 09:29:53 postgres | Data page checksums are disabled.</br>2022-12-16 09:29:53 postgres | </br>2022-12-16 09:29:53 postgres | fixing permissions on existing directory /var/lib/postgresql/data ... ok</br>2022-12-16 09:29:53 postgres | creating subdirectories ... ok</br>2022-12-16 09:29:53 postgres | selecting dynamic shared memory implementation ... posix</br>2022-12-16 09:29:53 postgres | selecting default max_connections ... 100</br>2022-12-16 09:29:53 postgres | selecting default shared_buffers ... 128MB</br>2022-12-16 09:29:53 postgres | selecting default time zone ... Etc/UTC</br>2022-12-16 09:29:53 postgres | creating configuration files ... ok</br>2022-12-16 09:29:53 postgres | running bootstrap script ... ok</br>2022-12-16 09:29:54 postgres | performing post-bootstrap initialization ... ok</br>2022-12-16 09:29:54 postgres | initdb: warning: enabling "trust" authentication for local connections</br>2022-12-16 09:29:54 postgres | You can change this by editing pg_hba.conf or using the option -A, or</br>2022-12-16 09:29:54 postgres | --auth-local and --auth-host, the next time you run initdb.</br>2022-12-16 09:29:54 postgres | syncing data to disk ... ok</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | Success. You can now start the database server using:</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | pg_ctl -D /var/lib/postgresql/data -l logfile start</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | waiting for server to start....2022-12-16 12:29:54.305 UTC [48] LOG: starting PostgreSQL 12.13 (Debian 12.13-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.311 UTC [48] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"</br>2022-12-16 09:29:54 store-backend-api-1 | </br>2022-12-16 09:29:54 store-backend-api-1 | > store-backend#0.0.1 start:dev</br>2022-12-16 09:29:54 store-backend-api-1 | > nest start --watch</br>2022-12-16 09:29:54 store-backend-api-1 | </br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.338 UTC [49] LOG: database system was shut down at 2022-12-16 12:29:54 UTC</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.345 UTC [48] LOG: database system is ready to accept connections</br>2022-12-16 09:29:54 postgres | done</br>2022-12-16 09:29:54 postgres | server started</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.434 UTC [48] LOG: received fast shutdown request</br>2022-12-16 09:29:54 postgres | waiting for server to shut down....2022-12-16 12:29:54.444 UTC [48] LOG: aborting any active transactions</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.445 UTC [48] LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.445 UTC [50] LOG: shutting down</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.482 UTC [48] LOG: database system is shut down</br>2022-12-16 09:29:54 postgres | done</br>2022-12-16 09:29:54 postgres | server stopped</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | PostgreSQL init process complete; ready for start up.</br>2022-12-16 09:29:54 postgres | </br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.552 UTC [1] LOG: starting PostgreSQL 12.13 (Debian 12.13-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.552 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.552 UTC [1] LOG: listening on IPv6 address "::", port 5432</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.563 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.592 UTC [67] LOG: database system was shut down at 2022-12-16 12:29:54 UTC</br>2022-12-16 09:29:54 postgres | 2022-12-16 12:29:54.600 UTC [1] LOG: database system is ready to accept connections</br>
And then the previous messages disappear and the following ones are shown:
[12:29:55 PM] Starting compilation in watch mode...</br>2022-12-16 09:29:55 store-backend-api-1 | </br>2022-12-16 09:29:58 store-backend-api-1 | [12:29:58 PM] Found 0 errors. Watching for file changes.</br>2022-12-16 09:29:58 store-backend-api-1 | </br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [NestFactory] Starting Nest application...</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +65ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] AppModule dependencies initialized +0ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] ConfigModule dependencies initialized +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] TypeOrmCoreModule dependencies initialized +49ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] TypeOrmModule dependencies initialized +0ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [InstanceLoader] UserModule dependencies initialized +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RoutesResolver] AppController {/api}: +7ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RouterExplorer] Mapped {/api, GET} route +4ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RouterExplorer] Mapped {/api/test, GET} route +0ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RoutesResolver] UserController {/api/users}: +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RouterExplorer] Mapped {/api/users, POST} route +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [RouterExplorer] Mapped {/api/users, GET} route +1ms</br>2022-12-16 09:29:59 store-backend-api-1 | [Nest] 29 - 12/16/2022, 12:29:59 PM LOG [NestApplication] Nest application successfully started +3ms
Add this to tsconfig.json.
"watchOptions": {
// Use native file system events for files and directories
"watchFile": "priorityPollingInterval",
"watchDirectory": "dynamicprioritypolling",
// Poll files for updates more frequently
// when they're updated a lot.
"fallbackPolling": "dynamicPriority",
// Don't coalesce watch notification
"synchronousWatchDirectory": true,
// Finally, two additional settings for reducing the amount of possible
// files to track work from these directories
"excludeDirectories": ["**/node_modules", "dist"]
}
Try this. I downloaded your code an tested it. You have a permission problem. Remove container and delete docker volumes , then run docker compose with this changes in the Dockerfile:
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine As development
USER root
# Create app directory
WORKDIR /usr/src/app
# Copy application dependency manifests to the container image.
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available).
# Copying this first prevents re-running npm install on every code change.
COPY package*.json ./
# Install app dependencies using the `npm ci` command instead of `npm install`
RUN npm ci
# Bundle app source
COPY . .
RUN npm run build
# Use the node user from the image (instead of the root user)
USER node
OK! This is very strange!
I probably solved this by deleting all files inside my project and recreating new files.
Some files, I copied from the tutorial repository below. Other files, I manually recreated. But in all I put the old content, without changes.
Maybe there was some file permission issue that didn't allow hot reloading. I am not sure! But the hot reload is working, for now.
https://www.tomray.dev/nestjs-docker-compose-postgres

docker-compose successfully running but cannot access my application

So I have successfully gotten working my docker-compose.yml file with docker-compose up but I cannot access the web application at localhost:3000
This is the docker-compose.yml:
version: '3.9'
services:
api:
build:
context: .
dockerfile: greatly-annoying-server.Dockerfile
ports:
- "8181:8181"
- "3000:3000"
web-app:
build:
context: .
dockerfile: greatly-annoying-portal.Dockerfile
ports:
- "4200:4200"
When I do a docker-compose ps I see:
greatly-annoying-portal_api_1 Up 0.0.0.0:3000->3000/tcp, 0.0.0.0:8181->8181/tcp
greatly-annoying-portal_web-app_1 Up 0.0.0.0:4200->4200/tcp
The Dockerfile for the greatly-annoying-server:
FROM node:14
RUN mkdir -p /gap
WORKDIR /gap
COPY package.json /gap/
COPY decorate-angular-cli.js .
RUN yarn install --frozen lockfile
COPY dist/ /gap/
# Environment Variables (overridable through `-e` or `-env-file` switches)
ENV CORS_ORIGINS="/http(s)?:\/\/(localhost:4200|gap(-staging)?\.freakinannoying\.com)+/"
ENV MONGODB_HOST='ec2-12-3-45-678.compute-1.amazonaws.com:27017'
ENV MONGODB_DB="web-staging"
ENV MONGODB_USER="gapstaging"
ENV MONGODB_PASS="asdfghjkl"
ENV clientSecret="asdfghjkl"
ENV clientID="98765432qasertokjhgfdsxcfvg.apps.googleusercontent.com"
ENV localwebservices="http://internal-stuff-ws-lb-987654321.us-east-1.elb.amazonaws.com"
ENV seskey="asdfghjkl"
ENV sesid="asdfghjk"
ENV dynamodbkey="asdfghjkl"
ENV dynamodbid="asdfghjkl"
ARG NODE_ENV
ENV REDIRECT_HOST=${NODE_ENV:+https://rough.freakinannoying.com}
ENV middletier_url="http://ruby-lightning-staging.freakinannoying.com"
ENV REDIRECT_HOST=${REDIRECT_HOST:-https://gap.freakinannoying.com}
ENV NODE_ENV=${NODE_ENV}
ENV NODE_ENV $NODE_ENV
ENV GAP_PORT 3000
EXPOSE ${GAP_PORT}
# Execute
CMD ["node", "apps/api/main.js”]
This is the Dockerfile from the web-app:
FROM node:14
WORKDIR /gap/
COPY package.json .
COPY decorate-angular-cli.js .
COPY yarn.lock .
ENV GROUP_NPM_TOKEN="234RTYUJKLKJH"
RUN npm config set #great-web:registry http://git.hoosiers.com/api/v4/packages/npm/
RUN npm config set //git.hoosiers.com/api/v4/packages/npm/:_authToken=${GROUP_NPM_TOKEN}
RUN npm config set //git.hoosiers.com/api/v4/projects/:_authToken=${GROUP_NPM_TOKEN}
RUN yarn add typescript
RUN yarn install --frozen lockfile
ENV CORS_ORIGINS="/http(s)?:\/\/(localhost:4200|visualize|hugo\.freakinannoying\.com)+/"
ENV CORS_METHODS="GET,PUT,POST,DELETE,HEAD,OPTIONS"
ENV CORS_ALLOWED_HEADERS="Origin, X-Requested-With, X-Forwarded-For, X-Auth-Token, X-Compression, Content-Type, Accept, Authorization, authtoken"
ENV gpbea="https://gpbe.freakinannoying.com"
ENV gaapi="http://greatly-data-api-lb-67890987654.us-east-1.elb.amazonaws.com/v1"
ENV apikey="<api_key>"
ENV apikey="<api_key>"
ENV NPM_TOKEN=<token>
ENV rewindkey="<key>"
ENV rewindurl="https://api.greatlyannoying.com/v1-staging/histfut"
ENV CORS_ORIGINS="/http(s)?:\/\/(localhost:4200|gap(-staging)?\.freakinannoying\.com)+/"
ENV MONGODB_HOST="<mongo-host-ip>"
ENV MONGODB_DB="web-staging"
ENV MONGODB_USER="gapstaging"
ENV MONGODB_PASS="NBGFRT678IOIUYTRDFGHJK"
ENV REDIRECT_HOST="http://localhost:4200"
ENV middletier_url="http://localhost:3000"
ENV clientSecret="nbvfr5678u98uyhjkl"
ENV clientID="0987654321-asdfghjkiuytrtyhbnjkl.apps.googleusercontent.com"
ENV localwebservices="http://localhost:8181"
ENV seskey="SDFGHJKpmnbgftyuik"
ENV sesid="ASDFGHJKL"
ENV dynamodbkey="SDFGHJKpmnbgftyuik"
ENV dynamodbid="ASDFGHJKL"
COPY ./dist .
CMD ["node", "apps/api/main.js"]
This is the logs:
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/exclusions/locations, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/exclusions/locations, POST} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/exclusions/locations/:id, PUT} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/exclusions/locations/:id, DELETE} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RoutesResolver] SegmentsController {/api/segments} (version: 1): +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/cachesegments, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/cachedeliveries, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/deliveries, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/deliveries/:enddate?, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/deliveries/next/:next?, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/deliveries-dates, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/removedeliveries/:date, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/:id, PUT} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/segments/:id, DELETE} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RoutesResolver] ChainsController {/api/chains} (version: 1): +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/chains, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/chains/count, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/chains/:id, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/chains/:id/count, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RoutesResolver] TagsController {/api/tags} (version: 1): +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/tags, GET} (version: 1) route +1ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [RouterExplorer] Mapped {/api/tags/:id, GET} (version: 1) route +0ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG [NestApplication] Nest application successfully started +5ms
[Nest] 1 - 08/18/2022, 7:15:42 PM LOG Gravy Admin Portal (GAP) Middle Tier listening on http://localhost:3000

Nextcloud container after move

I have server, which is hp t620 with 64gb ssd inside and two 1tb hdd disk in the cover connected by USB 3.0 and configured in RAID 1 (cover has option to configured RAID 1, 0 and JBOD). HDD disk are mounted under /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5
It operates under OMV 5.10.
I installed the docker by OMV web GUI in /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5/dane_aplikacji/docker. I run on the docker the nextcloud server app from the docker-compose file:
version: '3'
services:
proxy:
image: jwilder/nginx-proxy:alpine
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
container_name: nextcloud-proxy
networks:
- nextcloud_network
ports:
- 88:80
- 444:443
volumes:
- ./proxy/conf.d:/etc/nginx/conf.d:rw
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw
- ./proxy/html:/usr/share/nginx/html:rw
- ./proxy/certs:/etc/nginx/certs:ro
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- VIRTUAL_PROTO=https
- VIRTUAL_PORT=444
restart: unless-stopped
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nextcloud-letsencrypt
depends_on:
- proxy
cap_add:
- NET_ADMIN
networks:
- nextcloud_network
environment:
- PUID=998 #change PUID if needed
- PGID=100 #change PGID if needed
- TZ=Europe/Warsaw # change Time Zone if needed
- URL=myurl.duckdns.org
- SUBDOMAINS=www
- VALIDATION=https
- EMAIL=myaccount#gmail.com
volumes:
- ./proxy/certs:/etc/nginx/certs:rw
- ./proxy/vhost.d:/etc/nginx/vhost.d:rw
- ./proxy/html:/usr/share/nginx/html:rw
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
db:
image: mariadb
command: --skip-innodb-read-only-compressed
container_name: nextcloud-mariadb
networks:
- nextcloud_network
volumes:
- db:/var/lib/mysql
- /etc/localtime:/etc/localtime:ro
environment:
- MYSQL_ROOT_PASSWORD= SUPER_PASSWORD
- MYSQL_PASSWORD=SUPER_PASSWORD
- MYSQL_USER=nextcloud
- MYSQL_DATABASE=nextcloud
- MYSQL_HOST=db
restart: unless-stopped
app:
image: nextcloud:latest #ghcr.io/linuxserver/nextcloud
container_name: nextcloud-app
hostname: myurl.duckdns.org
networks:
- nextcloud_network
depends_on:
- letsencrypt
- proxy
- db
volumes:
- nextcloud:/var/www/html:z
- ./app/config:/var/www/html/config
- ./app/custom_apps:/var/www/html/custom_apps
- /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5/nextcloud:/var/www/html/data
- ./app/themes:/var/www/html/themes
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Warsaw
- VIRTUAL_HOST=myurl.duckdns.org
- LETSENCRYPT_HOST=myurl.duckdns.org:444
- LETSENCRYPT_EMAIL=myaccount#gmail.com
- PHP_MEMORY_LIMIT=20G
- MYSQL_ROOT_PASSWORD=SUPER_PASSWORD
- MYSQL_PASSWORD=SUPER_PASSWORD
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- NEXTCLOUD_HOSTNAME=myurl.duckdns.org
restart: unless-stopped
news-updater:
image: kr3ssh/nextcloud-news-updater
environment:
- INTERVAL=60
- NEXTCLOUD_URL=http://myurl.duckdns.org:88
- NEXTCLOUD_ADMIN_USER=PAN_ADMIN
- NEXTCLOUD_ADMIN_PASSWORD=SUPER_PASSWORD
restart: always
volumes:
nextcloud:
db:
networks:
nextcloud_network:
When I started to use the server i have only 16gb ssd inside and I had have docker files on the /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5/dane_aplikacji/docker but recently I installed 64gb ssd. I have taken OS img and installed it on the 64gb disk by rufus and expand partition. Docker and nextcloud work without no problem. Next I have copied docker file from /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5/dane_aplikacji/docker to /var/lib.docker and run docker from there by OMV web GUI. It was bad idea because nextcloud container hasn't worked. On the web page I only see:
Internal Server Error
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
In the nextcloud log file I see:
[Sat Jan 15 15:14:11.109982 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.51 (Debian) PHP/8.0.14 configured -- resuming normal operations
[Sat Jan 15 15:14:11.110121 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
ITS.MYI.P - - [15/Jan/2022:15:14:12 +0100] "GET / HTTP/1.1" 500 717 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ITS.MYI.P Safari/537.36 Edg/ITS.MYI.P"
ITS.MYI.P - admin [15/Jan/2022:15:14:38 +0100] "GET /index.php/apps/news/api/v1-2/cleanup/before-update HTTP/1.1" 500 717 "-" "Python-urllib/3.7"
In the nginx log file I see:
Lines
100
Actions
nginx.1 | 2022/01/15 15:14:08 [notice] 24#24: start worker processes
nginx.1 | 2022/01/15 15:14:08 [notice] 24#24: start worker process 30
nginx.1 | 2022/01/15 15:14:08 [notice] 24#24: start worker process 31
nginx.1 | 2022/01/15 15:14:08 [notice] 24#24: start worker process 32
nginx.1 | 2022/01/15 15:14:08 [notice] 24#24: start worker process 33
dockergen.1 | 2022/01/15 15:14:08 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
dockergen.1 | 2022/01/15 15:14:08 Watching docker events
dockergen.1 | 2022/01/15 15:14:08 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx.1 | myurl.duckdns.org ITS.MYI.P - admin [15/Jan/2022:15:14:08 +0100] "GET /index.php/apps/news/api/v1-2/cleanup/before-update HTTP/1.1" 503 190 "-" "Python-urllib/3.7" "-"
dockergen.1 | 2022/01/15 15:14:09 Received event start for container 70f8ad9b1266
dockergen.1 | 2022/01/15 15:14:09 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx.1 | myurl.duckdns.org ITS.MYI.P - - [15/Jan/2022:15:14:09 +0100] "GET / HTTP/1.1" 503 592 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ITS.MYI.P Safari/537.36 Edg/ITS.MYI.P" "-"
dockergen.1 | 2022/01/15 15:14:10 Received event start for container 94b2d83900f4
dockergen.1 | 2022/01/15 15:14:10 Generated '/etc/nginx/conf.d/default.conf' from 10 containers
dockergen.1 | 2022/01/15 15:14:10 Running 'nginx -s reload'
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 1 (SIGHUP) received from 37, reconfiguring
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: reconfiguring
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: using the "epoll" event method
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: start worker processes
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: start worker process 38
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: start worker process 39
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: start worker process 40
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: start worker process 41
nginx.1 | 2022/01/15 15:14:10 [notice] 30#30: gracefully shutting down
nginx.1 | 2022/01/15 15:14:10 [notice] 31#31: gracefully shutting down
nginx.1 | 2022/01/15 15:14:10 [notice] 30#30: exiting
nginx.1 | 2022/01/15 15:14:10 [notice] 32#32: gracefully shutting down
nginx.1 | 2022/01/15 15:14:10 [notice] 32#32: exiting
nginx.1 | 2022/01/15 15:14:10 [notice] 30#30: exit
nginx.1 | 2022/01/15 15:14:10 [notice] 32#32: exit
nginx.1 | 2022/01/15 15:14:10 [notice] 33#33: gracefully shutting down
nginx.1 | 2022/01/15 15:14:10 [notice] 33#33: exiting
nginx.1 | 2022/01/15 15:14:10 [notice] 33#33: exit
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 17 (SIGCHLD) received from 33
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: worker process 33 exited with code 0
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 29 (SIGIO) received
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 17 (SIGCHLD) received from 32
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: worker process 32 exited with code 0
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 29 (SIGIO) received
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 17 (SIGCHLD) received from 30
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: worker process 30 exited with code 0
nginx.1 | 2022/01/15 15:14:10 [notice] 24#24: signal 29 (SIGIO) received
nginx.1 | 2022/01/15 15:14:11 [notice] 31#31: exiting
I try with chmod 775 for /srv/dev-disk-by-uuid-9eac4f7c-81d6-48a7-9a4a-c8f20ceba7b5/nextcloud, /var/www and /var/lib/docker reinstalation apache2 and installation php and effect is the same.

Why running laravel app under jwilder/nginx-proxy I got 503 Service Temporarily Unavailable error?

Running laravel project based on jwilder/nginx-proxy I got error in browser
503 Service Temporarily Unavailable
nginx/1.21.1
with url:
http://127.0.0.1:80
Running docker and checking containers in my OS I see :
$ docker-compose up -d
nginx-projectname is up-to-date
php-radius is up-to-date
mysql-projectname is up-to-date
php-userend is up-to-date
php-projectname is up-to-date
user#HostingOS:/ProjectPath/lml$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4ccbc8fdeda roneichiarandi/php71-alpine "/entrypoint.sh php-…" 3 hours ago Up 21 minutes 0.0.0.0:32770->9000/tcp php-projectname
0b16d2c805df mysql:latest "docker-entrypoint.s…" 3 hours ago Up 20 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql-projectname
8b9f111aa298 roneichiarandi/php71-alpine "/entrypoint.sh php-…" 3 hours ago Up 21 minutes 0.0.0.0:32768->9000/tcp php-radius
3ae492cfdd89 roneichiarandi/php71-alpine "/entrypoint.sh php-…" 3 hours ago Up 21 minutes 0.0.0.0:32769->9000/tcp php-userend
2db8d9b0901e jwilder/nginx-proxy:latest "/app/docker-entrypo…" 3 hours ago Up 20 minutes 0.0.0.0:80->80/tcp nginx-projectname
9b9bf003a1a3 jwilder/nginx-proxy "/app/docker-entrypo…" 7 hours ago Exited (2) 6 hours ago inspiring_lovelace
05626a8da615 jwilder/nginx-proxy "/app/docker-entrypo…" 7 hours ago Created adoring_goldwasser
e5dddc493fe2 adminer "entrypoint.sh docke…" 8 months ago Up 2 hours 0.0.0.0:8095->8080/tcp gotoconsult_adminer
0c6a52f43a8b mysql:5.7.28 "docker-entrypoint.s…" 8 months ago Restarting (1) 44 seconds ago gotoconsult_db
docker-compose.yml :
version: '2'
services:
nginx: # NGINX-PROXY
image: 'jwilder/nginx-proxy:latest'
container_name: 'nginx-projectname'
ports:
- '80:80'
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/tmp/docker.sock
- ./docker/nginx.tmpl:/app/nginx.tmpl
- .:/var/www/html
# PHP7-alpine fpm
php:
container_name: 'php-projectname'
image: 'roneichiarandi/php71-alpine'
ports:
- "9000"
volumes:
- /etc/localtime:/etc/localtime:ro
- .:/var/www/html
- ./logs:/tmp/logs
environment:
- VIRTUAL_HOST=projectname.dev
- VIRTUAL_PORT=
- PHP_FPM=1
links:
- 'radius'
extra_hosts:
- "radius.dev:172.18.0.1"
# PHP7-alpine fpm
userend:
container_name: 'php-userend'
# image: 'matriphe/alpine-php:fpm-5.6'
image: 'roneichiarandi/php71-alpine'
ports:
- "9000"
volumes:
- /etc/localtime:/etc/localtime:ro
- ../userend:/var/www/html
- ../userend/logs:/tmp/logs
environment:
- VIRTUAL_HOST=userend.dev
- VIRTUAL_PORT=
- PHP_FPM=1
# PHP7-alpine fpm
radius:
container_name: 'php-radius'
image: 'roneichiarandi/php71-alpine'
ports:
- "9000"
volumes:
- /etc/localtime:/etc/localtime:ro
- ../radius:/var/www/html
- ../radius/logs:/tmp/logs
environment:
- VIRTUAL_HOST=radius.dev
- VIRTUAL_PORT=
- PHP_FPM=1
mysql:
container_name: 'mysql-projectname'
image: 'mysql:latest'
ports:
- "3306:3306"
volumes:
- /etc/localtime:/etc/localtime:ro
- mysqlvolume:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=projectname
volumes:
mysqlvolume:
I suppose url is valid
http://127.0.0.1:80
but what have I check in nginx options?
MODIFIED :
Checking nginx logs I see :
user#HostingOS:/ProjectPath$ docker-compose logs nginx
Attaching to projectname
projectname | WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one
projectname | is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded.
projectname | forego | starting dockergen.1 on port 5000
projectname | forego | starting nginx.1 on port 5100
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: using the "epoll" event method
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: nginx/1.21.1
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: built by gcc 8.3.0 (Debian 8.3.0-6)
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: OS: Linux 4.15.0-128-generic
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: getrlimit(RLIMIT_NOFILE): 1048576:1048576
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: start worker processes
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: start worker process 34
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: start worker process 35
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: start worker process 36
projectname | nginx.1 | 2021/09/01 10:31:56 [notice] 27#27: start worker process 37
projectname | dockergen.1 | 2021/09/01 10:31:57 Generated '/etc/nginx/conf.d/default.conf' from 7 containers
projectname | dockergen.1 | 2021/09/01 10:31:57 Running 'nginx -s reload'
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: signal 1 (SIGHUP) received from 40, reconfiguring
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: reconfiguring
projectname | dockergen.1 | 2021/09/01 10:31:57 Watching docker events
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: using the "epoll" event method
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: start worker processes
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: start worker process 44
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: start worker process 45
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: start worker process 46
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: start worker process 47
projectname | dockergen.1 | 2021/09/01 10:31:57 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 34#34: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 35#35: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 36#36: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 34#34: exiting
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 35#35: exiting
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 36#36: exiting
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 34#34: exit
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 35#35: exit
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 36#36: exit
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 37#37: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 37#37: exiting
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 37#37: exit
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: signal 17 (SIGCHLD) received from 34
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: worker process 34 exited with code 0
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: worker process 35 exited with code 0
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: worker process 36 exited with code 0
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: signal 29 (SIGIO) received
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: signal 17 (SIGCHLD) received from 37
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: worker process 37 exited with code 0
projectname | nginx.1 | 2021/09/01 10:31:57 [notice] 27#27: signal 29 (SIGIO) received
projectname | dockergen.1 | 2021/09/01 10:32:00 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:32:00 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | 2021/09/01 10:32:02 [notice] 49#49: signal process started
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 1 (SIGHUP) received from 49, reconfiguring
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: reconfiguring
projectname | Generating DSA parameters, 4096 bit long prime
projectname | dhparam generation complete, reloading nginx
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: using the "epoll" event method
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: start worker processes
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: start worker process 51
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: start worker process 52
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: start worker process 53
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: start worker process 54
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 44#44: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 45#45: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 46#46: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 47#47: gracefully shutting down
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 44#44: exiting
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 45#45: exiting
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 47#47: exiting
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 46#46: exiting
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 44#44: exit
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 45#45: exit
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 47#47: exit
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 46#46: exit
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 17 (SIGCHLD) received from 47
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: worker process 47 exited with code 0
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 29 (SIGIO) received
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 17 (SIGCHLD) received from 46
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: worker process 44 exited with code 0
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: worker process 46 exited with code 0
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 29 (SIGIO) received
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 17 (SIGCHLD) received from 45
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: worker process 45 exited with code 0
projectname | nginx.1 | 2021/09/01 10:32:02 [notice] 27#27: signal 29 (SIGIO) received
projectname | dockergen.1 | 2021/09/01 10:32:03 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:32:03 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:32:29 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:32:29 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:32:32 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:32:32 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | nginx.1 | 213.109.234.130 83.4.217.73 - - [01/Sep/2021:10:33:21 +0300] "GET / HTTP/1.1" 503 197 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"
projectname | dockergen.1 | 2021/09/01 10:33:24 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:33:24 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:33:26 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:33:27 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:34:27 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:34:27 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:34:29 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:34:30 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:35:30 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:35:31 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:35:33 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:35:33 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:36:34 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:36:34 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:36:36 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:36:36 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:37:37 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:37:37 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:37:39 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:37:40 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | nginx.1 | 213.109.234.130 205.185.126.200 - - [01/Sep/2021:10:37:54 +0300] "POST /boaform/admin/formLogin HTTP/1.1" 503 197 "http://213.109.234.130:80/admin/login.asp" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"
projectname | nginx.1 | _ 205.185.126.200 - - [01/Sep/2021:10:37:56 +0300] "" 400 0 "-" "-"
projectname | dockergen.1 | 2021/09/01 10:38:40 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:38:40 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:38:42 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:38:43 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:39:43 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:39:43 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:39:46 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:39:46 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:40:47 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:40:47 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:40:49 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:40:49 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:41:50 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:41:50 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:41:52 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:41:53 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:42:53 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:42:53 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:42:56 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:42:56 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:43:57 Received event start for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:43:57 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | dockergen.1 | 2021/09/01 10:43:59 Received event die for container 0c6a52f43a8b
projectname | dockergen.1 | 2021/09/01 10:43:59 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
projectname | SIGQUIT: quit
Any hints how it can be checked/fixed ?
Entering the bas with command :
docker-compose exec nginx bash
I check root directory and find file dhparam.pem.default:
root#2db8d9b0901e:/app# ls -la
total 112
drwxr-xr-x 4 root root 4096 Aug 30 03:03 .
drwxr-xr-x 1 root root 4096 Sep 1 10:31 ..
-rw-rw-rw- 1 root root 54 Aug 30 03:01 .dockerignore
drwxrwxrwx 3 root root 4096 Aug 30 03:01 .github
-rw-rw-rw- 1 root root 34 Aug 30 03:01 .gitignore
-rw-rw-rw- 1 root root 2244 Aug 30 03:01 Dockerfile
-rw-rw-rw- 1 root root 2223 Aug 30 03:01 Dockerfile.alpine
-rw-rw-rw- 1 root root 1079 Aug 30 03:01 LICENSE
-rw-rw-rw- 1 root root 472 Aug 30 03:01 Makefile
-rw-rw-rw- 1 root root 115 Aug 30 03:01 Procfile
-rw-rw-rw- 1 root root 29137 Aug 30 03:01 README.md
-rw-rw-rw- 1 root root 424 Aug 30 03:01 dhparam.pem.default
-rw-rw-rw- 1 root root 534 Aug 30 03:01 docker-compose-separate-containers.yml
-rw-rw-rw- 1 root root 281 Aug 30 03:01 docker-compose.yml
-rwxrwxrwx 1 root root 1448 Aug 30 03:01 docker-entrypoint.sh
-rwxrwxrwx 1 root root 2058 Aug 30 03:01 generate-dhparam.sh
-rw-rw-rw- 1 root root 133 Aug 30 03:01 network_internal.conf
-rwxrwxrwx 1 root root 10096 Aug 31 18:26 nginx.tmpl
drwxrwxrwx 14 root root 4096 Aug 30 03:01 test
root#2db8d9b0901e:/app# cat dhparam.pem.default
-----BEGIN DH PARAMETERS-----
MIIBCAKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBAg==
-----END DH PARAMETERS-----
but not requested dhparam.pem file ?
I run the docker with command :
docker-compose up -d
Can it be that I have to run docker command with some parameters dealing dhparam.pem file?
Like copying into into app root ?
Thanks!

Docker-Compose container communication for microservices via Caddy v2

I have the following architecture:
Docker with Linux-Containers on Windows
A NodeJS microservice called register listens inside the docker-network on port 3100
a Caddy Container image from https://hub.docker.com/r/abiosoft/caddy/ for internal routing
a Mongo Container image
docker-compose.yaml
version: '3'
services:
mongodb:
build: ./data
container_name: "mongodb"
hostname: mongodb
ports:
- "27019:27017"
logging:
driver: none
router:
build:
context: ./
dockerfile: ./router/Dockerfile
volumes:
- ./router/etc/:/etc/
- ./router/.config/:/.config/
- ./router/home:/home/caddy/
ports:
- "3000:8080"
cap_add:
- CAP_NET_BIND_SERVICE
register:
build:
context: ./
dockerfile: ./development.docker
args:
SERVICE_NAME: register
container_name: "register"
environment:
FLASK_ENV: development
CaddyFile.json
"admin": {
"listen": "0.0.0.0:2019"
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": ["0.0.0.0:8080"],
"routes": [{
"handle": [{
"handler": "reverse_proxy",
"transport": {
"protocol": "http"
},
"upstreams": [
{
"dial":"register:3100"
}
]
}],
"match": [{
"path": ["/register", "/register/*"]
}],
"terminal": true
}, {
"handle": [{
"handler": "subroute",
"routes": [{
"handle": [{
"handler": "file_server",
"hide": ["/etc/caddy/Caddyfile"],
"root": "/home/caddy/web/" # index.html is shown when accessing localhost:3000
}]
}]
}],
"match": [{
"path": ["/"]
}],
"terminal": true
}]
}
}
}
}
}
Expected Behaviour
GET-Request to localhost:3000 shows index.html --> works
GET-Request to localhost:3000/register should return a JSON-Object
Actual Behaviour
I get the following error:
router_1 | 2020/01/30 12:24:20.688 ERROR http.log.error dial tcp: lookup register on [::1]:53: dial udp [::1]:53: connect: cannot assign requested address {"request": {"method": "GET", "uri": "/register/", "proto": "HTTP/1.1", "remote_addr":
"172.18.0.1:43612", "host": "localhost:3000", "headers": {"Accept-Encoding": ["gzip, deflate, br"], "Connection": ["keep-alive"], "Content-Type": ["application/json"], "User-Agent": ["PostmanRuntime/7.22.0"], "Accept": ["*/*"], "Cache-Control": ["no-cache"], "Postman-Token": ["a7558f06-c099-4bbe-bee9-97c50a8910b8"]}}, "status": 502, "err_id": "5nm6udifm", "err_trace": "reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:362)"}
I restarted docker-compose multiple times, tried to change DNS settings and strangely it worked in rare cases but just once.
As far as I know, all the containers are able to ping each other in the network, so there must be some kind of connection between them. As mentioned before, I am trying to run this network with Linux containers on a Windows machine. I also tried it on multiple Linux systems and everything worked just fine.
I am not sure, whether it is a DNS-Problem or something else?
Does anyone have any idea?
Thank you in advance.
UPDATE
here are the logs
mongodb | WARNING: no logs are available with the 'none' log driver
router_1 | 2020/01/30 13:42:26.969 INFO using provided configuration {"config_file": "/etc/caddy/caddyfile.json", "config_adapter": "json5"}
router_1 | 2020/01/30 13:42:26.982 INFO admin admin endpoint started {"address": "0.0.0.0:2019", "enforce_origin": false, "origins": ["0.0.0.0:2019"]}
router_1 | 2020/01/30 13:42:26.984 INFO tls cleaned up storage units
router_1 | 2020/01/30 13:42:26 [INFO][cache:0xc000324dc0] Started certificate maintenance routine
router_1 | 2020/01/30 13:42:27.099 INFO autosaved config {"file": "/.config/caddy/autosave.json"}
router_1 | 2020/01/30 13:42:27.099 INFO serving initial configuration
register |
register | > register#0.0.1 start:linux /app/services/register
register | > nodemon --watch src --ext ts --exec 'nest build && node ./dist/services/'$npm_package_name'/src/main'
register |
register | [nodemon] 2.0.2
register | [nodemon] to restart at any time, enter `rs`
register | [nodemon] watching dir(s): src/*/
register | [nodemon] watching extensions: ts
register | [nodemon] starting `nest build && node ./dist/services/register/src/main`
register | (node:30) [DEP0091] DeprecationWarning: crypto.DEFAULT_ENCODING is deprecated.
register | (node:30) [DEP0010] DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
register | (node:30) [DEP0011] DeprecationWarning: crypto.Credentials is deprecated. Use tls.SecureContext instead.
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [NestFactory] Starting Nest application...
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] MongooseModule dependencies initialized +50ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] ConfigHostModule dependencies initialized +2ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] ConfigModule dependencies initialized +1ms
register | (node:29) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the
new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
register | (node:29) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] MongooseCoreModule dependencies initialized +48ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] MongooseModule dependencies initialized +3ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [InstanceLoader] AppModule dependencies initialized +2ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [NestMicroservice] Nest microservice successfully started +12ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [RoutesResolver] AppController {/register}: +33ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [RouterExplorer] Mapped {/create, POST} route +16ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [NestApplication] Nest application successfully started +16ms
register | [Nest] 29 - 01/30/2020, 1:42:45 PM [Main] REGISTRATION LISTENING 2
router_1 | 2020/01/30 13:43:08.235 ERROR http.log.error dial tcp: lookup register on [::1]:53: dial udp [::1]:53: connect: cannot assign requested address {"request": {"method": "POST", "uri": "/register/create", "proto": "HTTP/1.1", "remote_addr": "172.20.0.1:53036", "host": "localhost:3000", "headers": {"Postman-Token": ["c3b7a4b1-d424-4fe0-8809-5d9fc38dd9dc"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Content-Type": ["application/json"], "Cache-Control": ["no-cache"], "User-Agent": ["PostmanRuntime/7.6.0"], "Accept": ["/"], "Content-Length": ["429"]}}, "status": 502, "err_id": "qx319czc0", "err_trace": "reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:362)"}
Unfortunately using depends_on in docker-compose.yaml does not work.

Resources