MCR-Digital / apprentice-boot-camp-databases

https://mcr-digital.github.io/apprentice-boot-camp-databases/public/slides/slide_000/
0 stars 8 forks source link
ksb-k10 ksb-s3

Database Bootcamp 2021

Competencies, Behaviours and Knowledge units

These relate to the KSBs defined in the Level 4 Software Developer standard.


Table of contents


 

Project Slides


Overview


Screenshot

Completed Sequel-Mart project web page: Sequel-Mart-Finished-Project

 


What you can expect

Day 1

Section 1 (What are databases?)

Section 2 (Querying a relational database - CRUD)

Section 3 (Changing content in a relational database - CRUD)


Day 2

Section 4 (Streamlining - making a relational database more efficient)

Section 5 (Sequel-Mart)

Section 6 (Exercises)


Timing and Breaks

Trying to absorb a lot of information in a short time can be exhausting. We will be aiming for 45 minutes of work followed by 15 minute breaks.

Get away from the monitor and take a real break. Pairing or not, taking breaks is important and increases productivity.

 


General Advice for the Bootcamp

Breakout rooms

There is no better way to learn a craft than to get stuck in and practice, practice, practice! Collaborating and bouncing ideas off each other helps too.

The first section is all theory but after that there will be regular sets of exercises. These exercises are an opportunity to split into groups, try to answer them, then come back together to fill in any gaps in our knowledge.

Camera Always On If Working Remotely

Working face-to-face is powerful because we communicate with the whole body, not just our words. And we are much more attentive because any distraction like looking at the smartphone during a discussion will be detected immediately.

So would advise activate our cameras all the time.

Whiteboard

In the absence of physical collaboration on a whiteboard, a tool like Miro is a reasonable alternaive. You can share the Miro board in a video conference, so that everyone puts their focus on the same section of the board.

 


Essential Tools

Optional Tools

 


Installing the Database and Website Services

This section contains a step-by-step guide to installing everything you need to successfully complete the exercises in this boot-camp.

These instructions are also available in the Slide deck - Setting up the Project  

Clone the Repository Locally

1.0 Clone the Repository

Docker Compose

2.0 Docker Services

Three services are defined in docker-compose.yml:

  1. database:
    • This runs a postgres database
    • Data is persisted between runs
  2. populate-database
    • This runs another postgres container which is only used to import the data in /database_backups/sequel-mart-20210919-complete
    • This only runs when the initialise profile is specified, so that it doesn’t have to run every time (otherwise it would try to recreate the database each time).
  3. app
    • This runs the application within a node image
    • This requires npm install to be run first, as the node modules are copied into the container

2.1 First time set up

Checks

2.1.1. Docker Desktop

This should now contain the following containers / apps:

2.1.2. Front-end web page
2.1.3. PgAdmin

This is the GUI for the Relational Database Management System (RDBMS) we will be using.

Once all the checks are complete use ctrl c or cmd c to stop docker.

2.2 Running the app

You can stop the services at any time by hitting ctrl-con the terminal session and terminating the batch job if prompted. Running ./run.sh or ./run.bat will restart the service.

2.3 Starting over

2.4 Possible Issues

There are a couple of known difficulties with setting this process up. Where found, possible workarounds are listed below. Should none of these work please feel free to reach out on the bootcamp Slack channel and/or post an issue to this repository.

2.4.1 Sometimes the database schemas in 2.1.3 don't appear.

This is due to a corruption in the pgadmin4_container container on setup. It causes the database to shut down before the database schemas are created. If this happens, try the following:

 


Software and Extensions Used

Front-End

If running locally, (make sure you set up a virtual environment in your project folder) once npm has been installed, run:

npm run scripts

Refer to package.json to see the full list

Back-End

Installing PostgreSQL Locally

This shouldn't be necessary if you're using Docker but should you want to do this:

Follow the steps to set:

  1. A default location for the Installation Directory

  2. The components and add-ons required (PostgreSQL Server, pgAdmin 4 & Command Line Tools as a minimum)

  3. A default directory for the databases

  4. A superuser user and password (retype to confirm)

  5. A port number for the database server to listen (defaults to 5432)

  6. Preview your choices

  7. Click Next to install PostgreSQL

  8. Click Finish when it’s done

Loading pgAdmin


 

Useful resources


 

Author

Thomas Steeples (course created while working for Zuto)


 

Acknowledgments