Local development

Requirements

* A directory named, for instance, rootdb, that will contains all code.
* Docker up & running. (with docker compose plugin installed too)
* For the frontend development you should have installed on your workstation :
* the latest version of Node.js
* the latest version of Yarn

Finally, you have to update your system hosts file and add these entries :

All entries to setup in your hosts file

Hostname

IPv4 address

dev-rootdb-api.localhost.com

172.20.0.40

dev-rootdb-ws-api.localhost.com

172.20.0.40

dev-rootdb-frontend.localhost.com

127.0.0.1

Get the code

First step, you have to get the code from these Github repositories, to store in you rootdb local directory :

  1. Infrastructure code, containing docker images for local development : github.com/RootDBApp/infra

  2. API code : github.com/RootDBApp/api

  3. Frontend code : github.com/RootDBApp/frontend

You should have something like that in your rootdb directory :

.
├── api
├── frontend
└── infra

Start development services

Frontend

It’s a usual React webapp, so you simply need to start the development server.
Go inside the frontend main directory and start it like this :
$ yarn install
$ yarn start-dev

[...]
Compiled successfully!

You can now view rootdb in the browser.

  http://dev-rootdb-frontend.localhost.com:3000

Note that the development build is not optimized.
To create a production build, use yarn build.

webpack compiled successfully
No issues found.

Tip

At this point, since API services are not yet started, the display of the frontend is broken, that’s normal :)

API

For the API, all is containerized with Docker. (MariaDB, Nginx, PHP-FPM, Memcached & Supervisor).
In a terminal, go inside infra/docker-compose-dev/rdb_mariaddb_memcached and start services with :
$ user=rootdb  docker compose up

[...]
dev-rootdb-api        |
dev-rootdb-api        |    INFO  Nothing to migrate.
dev-rootdb-api        |
dev-rootdb-api        | Starting services with supervisor...
dev-rootdb-api        | [22-Mar-2024 09:40:04] NOTICE: fpm is running, pid 1
dev-rootdb-api        | [22-Mar-2024 09:40:04] NOTICE: ready to handle connections
dev-rootdb-api        | [22-Mar-2024 09:40:04] NOTICE: systemd monitor interval set to 10000ms
And that’s all.
You can now refresh your web browser, that should already be opened on dev-rootdb-frontend.localhost.com:3000 and RootDB should be displayed correctly.

Tip

If you need to run composer, supervisor, or Laravel artisan command, you have to go inside the API container :

$ docker exec -it dev-rootdb-api bash