Sunday, 3 May 2020

Node_modules and editing local files

In order to map the local host files to the container working directory, you need to have the node_modules directory locally. Otherwise, the modules "Cannot be found".


With your new package.json file, run npm install. If you are using npm version 5 or later, this will generate a package-lock.json file which will be copied to your Docker image.

Since "npm install" is not possible without installing nodejs (that's why I user docker!), you have to run npm install inside a container which maps the local files.(/home/ec2-user/teams/node:/hasapian)
This could be run by running docker-compose without a volume at first of by building a node image.

Then add the volume above in the docker-compose.yaml and you are good to go!

Module versions:
https://semver.npmjs.com/

Monday, 20 April 2020

Git

Check os version in Linux: cat /etc/os-release

Install git for Fedora: sudo yum install git

Logged in with Administrator user and generated git credentials stored in notepad.

The created repository "hasapian-foods" can be found in the link below:

https://us-east-2.console.aws.amazon.com/codesuite/codecommit/repositories?region=us-east-2

Created github repository as well:

https://github.com/hasapian/foods

"git add ." works
"git status" is really helpful

Sunday, 19 April 2020

Connected!







Authentication error:
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

Solved by adding

command: --default-authentication-plugin=mysql_native_password

in the docker-compose.yaml file (found in the docker hub mysql image Readme file). Idea for the solution provided by
















https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server

We also had issue with nodejs running before mysql server being ready. Changed entrypoint in docker-compose to app.js which does not connect to db. Then run dbhandler.js like the first image.

depends_on does not soleve the above issue. Scripts need to be created like the links below:




from https://docs.docker.com/compose/compose-file/

Solutions in case we need it in the future:

https://docs.docker.com/compose/startup-order/
Search for "No connections until MySQL init completes" in https://hub.docker.com/_/mysql
2 links are provided at the end.




Package json dependencies

To specify the packages your project depends on, you must list them as "dependencies" or "devDependencies" in your package’s package.json file. When you (or another user) run npm install, npm will download dependencies and devDependencies that are listed in package.json that meet the semantic version requirements listed for each


Friday, 17 April 2020