JCL

FEUP/DEI & INESC TEC

User Tools

Site Tools


teach:lbaw:tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Previous revision
teach:lbaw:tools [26/03/2020 15:30]
teach:lbaw:tools [01/04/2021 13:55] (current)
Sérgio Nunes [5. Develop the project with Docker, Laravel & PostgreSQL]
Line 1: Line 1:
 +====== Computational resources ======
  
 +**Master in Informatics and Computing Engineering\\
 +  Database and Web Applications Laboratory\\
 +  Instance: 2020/2021**
 +\\
 +---
 +\\
 +
 +This page describes the computational resources required for the development of the project.
 +
 +===== - Version Control with Git =====
 +
 +Git is the version control system used during LBAW.
 +The group (gg) repository is https://git.fe.up.pt/lbaw/lbaw2021/lbaw21gg.
 +The teacher adds you to the repository in the first class.
 +
 +Make sure you login in https://git.fe.up.pt/ before the first class, so that your account is created in the system.
 +
 +The repository's README file must include:
 +  * Group reference (lbaw21gg)
 +  * Project theme (e.g. "1. Collaborative news")
 +  * List of team members, including names and email addresses
 +
 +The group must ensure that the repository remains private, visible only by the team members and the teacher. 
 +
 +[[https://git-scm.com/documentation|Git Documentation]] | 
 +[[https://git-scm.com/docs/user-manual.html|Git User Manual]] | 
 +[[https://git-scm.com/docs/gittutorial|A tutorial introduction to Git]]
 +
 +===== - Develop the User Interfaces Prototype =====
 +
 +The User Interface Prototype (PIU) is composed by a subset of the user interfaces the group have to develop for the project. 
 +The pages are static HTML pages that use the Bootstrap framework.
 +
 +The group starts the PIU by copying the files available at the template repository (https://git.fe.up.pt/lbaw/template-piu) to his own repository, and then follow the instructions, detailed in the README, to set up the technologies needed for the development.
 +
 +The PIU uses an HTTP server to serve your HTML or PHP files. An HTTP server is created inside the Docker container using the bundled ''Dockerfile'' (see the README for the required steps). The templace currently provides a Docker image with PHP+Apache. 
 +
 +Once the PIU pages are developed, the group builds and uploads a Docker image (''lbaw21gg-piu'') to the group Docker hub repository (see the README for the required steps). 
 +
 +Using the FEUP VPN, the project will be available at http://lbaw21gg-piu.lbaw-prod.fe.up.pt.
 +Be aware that these interfaces need to be available for evaluation. 
 +Otherwise, the group won't be graded in that component.
 +
 +[[https://docs.docker.com/get-started/|Docker documentation]] |
 +[[https://docs.docker.com/docker-hub/|Overview of Docker Hub]]
 +
 +===== - Docker Caveats =====
 +
 +If you are using your own machine for development you won't likely face the problems described here. 
 +If you are using FEUP's desktop computers, you must read this section. 
 +Docker server is not installed natively on Windows and Linux, so we need to run it inside a virtual machine. 
 +
 +On Windows, you need to open the **Links** folder on your desktop and start the Docker-toolbox executable. 
 +This will download a virtual machine and set everything for you. 
 +Keep the Docker-toolbox window open. 
 +Once running, you can use the Docker and Docker-compose binaries that are already set on your Windows Path. 
 +Note that as the Docker service is running inside a virtual machine, you do not have access to it using localhost.
 +Instead, you need to use the IP address presented on the Docker-toolbox window.
 +
 +The process is similar in Linux, but there's no Docker-toolbox available to automatically set up the virtual machine that runs Docker. 
 +We've set one up that you can [[https://drive.google.com/open?id=18sg6SLi6_X94rbiAxQnglWGcuViJxb5s|download it from here]]. 
 +Note that the image is large and won't likely fit in your user home, you should download it to the ''/tmp/'' folder. 
 +The username and password for the image is "lbaw"
 +The image is configured to run with a bridged network card, which will provide an IP address with which you can interact with it. 
 +You can check this IP address with ''ifconfig'' command inside the terminal.
 +
 +{{ :teach:lbaw:ifconfig.png?direct |}}
 +
 +You can then use that IP address to instruct your local Docker client to connect to the Docker server running inside the virtual machine, by setting the Docker_HOST environment variable. 
 +Docker is running inside the VM in port 4243, so you can set the variable with ''%%export DOCKER_HOST tcp://192.168.1.30:4243%%''
 +Feel free to add this to your bash profile so that it is set on every session. 
 +From here on, you can run Docker commands locally that are executed inside the VM. 
 +
 +===== - Persist data with PostgreSQL =====
 +
 +PostgreSQL is an object-relational database management system (ORDBMS) used in the course.
 +
 +A production environment of PostgreSQL is provided, which is used in the application's production version. 
 +Each group (gg) will be provided with a PostgreSQL user account __lbaw21gg__, with the group password, and a database ''lbaw21gg'' available on the production machine (''dbm.fe.up.pt'') inside the FEUP VPN.
 +
 +To configure a connection to the database the following attributes are used:
 +
 +**Host name**: dbm.fe.up.pt\\
 +**Port**: 5432\\
 +**Maintenance database**: lbaw21gg\\
 +**Username**: lbaw21gg\\
 +**Password**: <group password>
 +
 +But, for now, a development environment of PostgreSQL can be used with Docker containers.
 +The group starts by copying the files available at the template repository (https://git.fe.up.pt/lbaw/template-postgresql) to a new branch of his own repository, and then follow the instructions, detailed in the README, to setup the technologies needed for the development.
 +
 +[[http://www.postgresql.org/docs/13/static/index.html|PostgreSQL 13.2 Documentation]] | [[https://www.pgadmin.org/|pgAdmin]] | 
 +[[https://docs.docker.com/get-started/|Docker documentation]]
 +
 +===== - Develop the project with Docker, Laravel & PostgreSQL =====
 +
 +The group develops a web application using the Laravel server framework. 
 +
 +The group starts the project by copying the files available at the template repository ([[https://git.fe.up.pt/lbaw/template-laravel]]) to their own repository, and then follow the instructions detailed in the README, to set up the development requirements.
 +
 +The project uses the PostgreSQL database management system. 
 +A local instance is created using the bundled Docker compose file (see the README for the required steps to start it).
 +
 +The group should keep an up to date Docker image of their project at all times  in the group's Docker hub repository (see the template README for the required steps).
 +
 +There is a practical guide available to help you build your prototype using the work done in the previous artefacts, namely A3 and A6, see [[https://docs.google.com/document/d/1AyRvuXLQjlELYuRbuJbiNiNTVs1WcBrSKlcd2cNIDBs|LBAW A8: Putting it all together
 +]]
 +
 +[[https://laravel.com/docs/8.x/readme|Laravel documentation]] | [[https://docs.docker.com/get-started/|Docker documentation]] | [[http://www.postgresql.org/docs/13/static/index.html|PostgreSQL 13.2 Documentation]] | [[https://www.pgadmin.org/|pgAdmin]]
 +
 +
 +**To be continued...**
 +
 +\\
 + --- //LBAW//