ElsaSusan98 / FurryFriendFinder

Connecting Pets and Professionals
0 stars 0 forks source link

MySQL, PHPMyAdmin and Node.js (ready for Express development)

This will install Mysql and phpmyadmin (including all dependencies to run Phpmyadmin) AND node.js

This receipe is for development - Node.js is run in using supervisor: changes to any file in the app will trigger a rebuild automatically.

For security, this receipe uses a .env file for credentials. A sample is provided in the env-sample file. If using these files for a fresh project, copy the env-sample file to a file called .env. Do NOT commit the changed .env file into your new project for security reasons (in the node package its included in .gitignore so you can't anyway)

In node.js, we use the MySQl2 packages (to avoid problems with MySQL8) and the dotenv package to read the environment variables.

Local files are mounted into the container using the 'volumes' directive in the docker-compose.yml for ease of development.

Super-quickstart your new project:

Visit phphmyadmin at:

http://localhost:8081/

Visit your express app at:

http://localhost:3000

For reference, see the video at: https://roehampton.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=6f290a6b-ba94-4729-9632-adcf00ac336e

NB if you are running this on your own computer rather than the azure labs that has been set up for you, you will need to install the following:

Whats provided in these scaffolding files?


Useful commands:

Get a shell in any of the containers

docker exec -it <container name> bash -l

Once in the database container, you can get a MySQL CLI in the usual way

mysql -uroot -p<password>