danwahlin / codewithdandockerservices Goto Github PK
View Code? Open in Web Editor NEWDemonstration of using Docker and/or Kubernetes to orchestrate multiple services
License: MIT License
Demonstration of using Docker and/or Kubernetes to orchestrate multiple services
License: MIT License
volume
(below) if doing a production builddocker logs nginx
:2022/05/31 01:25:15 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:15 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:16 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:16 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:17 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:19 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:23 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:29 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:25:43 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:26:08 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:27:00 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:28:00 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:29:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:30:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:31:01 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:32:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:33:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:34:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:35:02 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:36:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:37:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:38:03 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:39:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:40:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:41:04 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
2022/05/31 01:42:05 [emerg] 1#1: host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
nginx: [emerg] host not found in upstream "node:8080" in /etc/nginx/nginx.conf:28
Hi Dan,
Thanks for good code. I am able to build other images properly but build for mongo image is not working from corporate firewall proxy. Please find below the errors.
Errorrs:
_---> Running in 24eb6fa4206e
Err http://repo.mongodb.org jessie/mongodb-org/3.4 InRelease
Err http://repo.mongodb.org jessie/mongodb-org/3.4 Release.gpg
Unable to connect to repo.mongodb.org:http:
---> 25ea78fb5b0b
Err http://deb.debian.org jessie InRelease
Err http://deb.debian.org jessie-updates InRelease
Err http://deb.debian.org jessie Release.gpg
Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]
Err http://deb.debian.org jessie-updates Release.gpg
Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]
Err http://security.debian.org jessie/updates InRelease
Err http://security.debian.org jessie/updates Release.gpg
Unable to connect to security.debian.org:http: [IP: 195.20.242.89 80]
Removing intermediate container 24eb6fa4206e
Step 7/8 : EXPOSE 27017
Reading package lists... ---> Running in 47c172f04e22
---> e36b88f91680
Removing intermediate container 47c172f04e22
Step 8/8 : ENTRYPOINT /mongo_scripts/run.sh
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease
W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease
W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/3.4/InRelease
W: Failed to fetch http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/3.4/Release.gpg Unable to connect to repo.mongodb.org:http:
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg Unable to connect to deb.debian.org:http: [IP: 149.20.4.15 80]
W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Unable to connect to security.debian.org:http: [IP: 195.20.242.89 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
---> Running in 9abd7a5c214b
Reading package lists... ---> 914a5eed5c5e
Removing intermediate container 9abd7a5c214b
Successfully built 914a5eed5c5e
Successfully tagged maheshk172/mongo:latest
Building redis
Building dependency tree...
Reading state information...
E: Unable to locate package cron
E: Unable to locate package netcat-traditional
E: Unable to locate package netcat-openbsd
Service 'mongo' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y cron netcat-traditional netcat-openbsd' returned a non-zero code: 100_
I tried adding the http_proxy, https_proxy under the mongo.development.env but it did not helped.
I also tried adding a /etc/apt/apt.conf file with a proxy configuration and copy them before running apt-get update commands, as suggested on the UBUNTU forums, but it did not helped as well
Could you please help with this issue?
Starting mongo ...
Starting mongo ... done
Recreating node-codewithdan ... done
nginx is up-to-date
Attaching to redis, mongo, node-codewithdan, nginx
mongo | standard_init_linux.go:211: exec user process caused "no such file or directory"
mongo exited with code 1
Connection error: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [Error: getaddrinfo ENOTFOUND mongo
node-codewithdan | 22:26:39 0|codewithdan | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {
node-codewithdan | 22:26:39 0|codewithdan | name: 'MongoNetworkError',
node-codewithdan | 22:26:39 0|codewithdan | [Symbol(mongoErrorContextSymbol)]: {}
node-codewithdan | 22:26:39 0|codewithdan | }]
@DanWahlin - Can you tell me which commit would be best to checkout for following along with the Pluralsight course? I'm on Module 8 (Managing Containers with Docker Compose) and would like to take a look at the code prior to the Kubernetes updates and other things not yet covered in the lessons. Thanks - enjoying the course.
In the course: "Kubernetes for Developers: Core Concepts, 7 Creating ConfigMaps and Secrets, Secrets in Action", the mongo.deployment.yml
does not create an admin user or allow authentication at the shell level or otherwise.
I followed the steps create the secrets with kubectl
and using the current version of mongo.deployment.yml
: https://github.com/DanWahlin/DockerAndKubernetesCourseCode/blob/main/samples/secrets/mongo.deployment.yml
Output after pod creation:
➜ secrets k apply -f mongo.deployment.yml
configmap/mongo-secrets-env created
storageclass.storage.k8s.io/local-storage created
persistentvolume/mongo-pv created
persistentvolumeclaim/mongo-pvc created
statefulset.apps/mongo created
➜ secrets k get pods
NAME READY STATUS RESTARTS AGE
mongo-0 1/1 Running 0 3s
node-configmap-577f5d6b98-qlwwb 1/1 Running 0 140m
Output attempting to auth inside mongo
shell in the pod:
➜ ckad_training k exec mongo-0 -it sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
# mongo
MongoDB shell version v5.0.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a66eee69-b066-4639-b06f-422745204d16") }
MongoDB server version: 5.0.6
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
https://community.mongodb.com
> db.auth("admin", "password")
Error: Authentication failed.
0
> use codeWithDan
switched to db codeWithDan
> db.auth("admin", "password")
Error: Authentication failed.
0
Output from Studio T3 (using legacy SHA-1, but basic SHA-256 has same result):
Would love to know what the solution is here as I was not able to find anything. Thanks!
Hello Sir,
Thanks for plurasight tutorial. It help me a lot.
I am getting above exception on docker-compose up. I did share you a git hub link to access my code.
It's very simple code. I would really appreciate your help.
HI Dan,
thank you for the excellent tutorial on Docker.
I am getting the error 'Error: Cannot find module 'express'' when I try to run 'docker-compose up'. I added 'npm install -g express' in node-codeqwithdan.$app-env.dockerfile, it didn't help.
Please help.
Rafeeq
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.