Skip to content
André Jesus edited this page May 3, 2024 · 38 revisions

Phase 4

Introduction

This document describes the requirements for the fourth and final phase of the Software Laboratory project.

Requirements

Additional Operations

  • Update the create user operation, to receive a password.
  • Create a new operation that receives the user's email and password, and returns the user's token.

Single Page Application

  • Produce views to create a new user (Sign In) and to obtain the user's token (Login).
  • The received token should be stored until the user closes the browser window/tab or explicitly executes logout.

Hosting on Render

Host the application on the Render.

  1. Create a Render free account. Render is an example of a Platform-as-a-Service (PaaS) provider.

  2. On the Render web site, create a new PostgreSQL instance

    • Give it the Name: db-ls-2223-2-<turma>-g<número-do-grupo>;
    • You can leave the Databaseand User fields empty;
    • Select the "Frankfurt(EU Central)" region;
    • Select the Free instance type, and click Create Database;
    • Wait for the creation of the database;
    • Create the tables in the render Postgres database, use psql, pgAdmin or a similar tool.
      • Note that the connection URL must be in the JDBC format (ex. jdbc:postgresql://<hostname>.frankfurt-postgres.render.com:<port>/<database>?user=<username>&password=<password>), so you will need to build it from the information provided in the render dashboard.
  3. On the command line, run gradlew build in the project root directory.

  4. Create a docker free account; for more information about the Docker environment, check here.

  5. Install Docker Desktop

  6. Add the Dockerfile to the root of the group repository, this file should contain all the information to create the docker image, see our example here.

  7. On the command line, do docker login.

  8. Create the docker image , on the command line, do docker build -t <docker-username>/img-ls-2223-2-<turma>-g<número-do-grupo> . (for Mac computers with M1 or M2 include --platform linux/amd64)

  9. Push the image to docker hub, on the command line, do docker push <docker-username>/img-ls-2223-2-<turma>-g<número-do-grupo>

  10. On the Render web site, create a new Web Service with the name service-ls-2223-2-<turma>-g<número-do-grupo>

    • Select Deploy an existing image from a registry
    • Insert Image URL, docker.io/<docker-username>/img-ls-2223-2-<turma>-g<número-do-grupo>
    • Name your application and select the "Frankfurt(EU Central)" region
    • Select the free instance type
    • Add a JDBC_DATABASE_URL environment variable to your the new Web Service, using the credentials available in render Postgres dashboard (ex. jdbc:postgresql://<hostname>.frankfurt-postgres.render.com:<port>/<database>?user=<username>&password=<password>)
  • Click create service and wait for the service creation

Note: The service port must be obtained from the environment variable PORT.

To launch application in developer machine:

  • docker run -d -p 9000:8080 --env PORT=8080 --env JDBC_DATABASE_URL="jdbc:postgresql://host.docker.internal/<database>?user=<username>&password=<password>" <username docker>/img-ls-2223-2-<turma>-g<número-do-grupo>

Refactoring code

This phase should be used to critically review all code baseline, and refactoring to improve code quality should be a goal. Also, more tests should be produced ir order to increase the overall coverage.

Report

The technical report should be updated and/or extended with the relevant technical information. The sections developed in the previous phases can be improved or changed. There should not be a separate report for each phase.

Delivery

The completed project must be delivery until June 11 (end of week 15), via the creation of a 1.0.0 tag on the GitHub repository.