diff --git a/README.md b/README.md index b0853e348..6dda8fa0a 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ When doing so, please adhere to our [machine](https://github.com/building-envelope-data/machine?tab=readme-ov-file#getting-started) and its instructions for the first stage of the set-up. +1. Start the containers of `machine` with `make up`. + 1. Change to the parent directory of `./machine` by running `cd ..`. 1. Clone the source code into `./development` by running @@ -74,7 +76,8 @@ When doing so, please adhere to our 1. List all GNU Make targets by running `make help`. 1. Create the PostgreSQL database and schema by running - `./database.mk create migrate`. + `./database.mk create migrate`. You can remove a conflicting old database + with `./database.mk remove-volume`. 1. Build and start all services and follow their logs by running `make build up logs`. @@ -116,6 +119,11 @@ In another shell 1. List all backend GNU Make targets by running `make help`. 1. For example, update packages and tools by running `make update`. 1. Drop out of the container by running `exit` or pressing `Ctrl-D`. +1. If you want to test the interaction between the metabase and a product data + server, follow the README section [Development/Getting Started]() of + repository [database](https://github.com/building-envelope-data/database). + Then you can test the interaction of metabase and a product data server + following the [tutorial](https://github.com/building-envelope-data/metabase/docs/tutorials/interaction_metabase_database.md). ### Migrating the Database @@ -251,7 +259,7 @@ and the pages following it. 1. Use the sibling project [machine](https://github.com/building-envelope-data/machine) and its instructions for the first stage of the set-up. 1. Enter a shell on the production machine using `ssh`. -1. Change into the directory `/app` by running `cd /app`. +1. Create and enter the directory `/app` with `mkdir /app && cd /app`. 1. Clone the repository twice by running ``` @@ -268,7 +276,7 @@ and the pages following it. 1. Change into the clone `${environment}` by running `cd /app/${environment}`. 1. Prepare the environment by running - `cp ./.env.${environment}.sample /app/data/.env.${environment} && chmod 600 /app/data/.env.${environment} && ln /app/data/.env.${environment} ./.env` + `cp ./.env.${environment}.sample /app/.env.${environment} && chmod 600 /app/.env.${environment} && ln /app/.env.${environment} ./.env` and by adjusting variable values in the copies to your needs, in particular, by setting passwords to newly generated ones, where random passwords may be generated by running `openssl rand -base64 32`. Here is @@ -330,7 +338,7 @@ and the pages following it. ### Deploying a release 1. Fetch the release branch by running `git fetch` and switch to it by running - `git switch --detach release/${TAG}`, where `${TAG}` is the release tag to + `git switch --detach ${TAG}`, where `${TAG}` is the release tag to be deployed, for example, `v1.0.0`. 1. Build and push the Docker images for the services `frontend` and `backend` services by running `./forge.mk all USER=cloud HOST=${IP}`, where `${IP}` is diff --git a/deploy.sh b/deploy.sh index dbafe26b9..ef093571d 100755 --- a/deploy.sh +++ b/deploy.sh @@ -523,6 +523,7 @@ deploy | restore | resume) print_error "Backup directory is unknown" exit 1 fi + run mkdir --parents "$(dirname "${attempt["backup_dir"]-}")" || exit 1 run ./database.mk backup DIR="${attempt["backup_dir"]-}" || exit 1 ;& # fall through switch) diff --git a/docs/tutorials/interaction_metabase_database.md b/docs/tutorials/interaction_metabase_database.md new file mode 100644 index 000000000..66e1b2ee4 --- /dev/null +++ b/docs/tutorials/interaction_metabase_database.md @@ -0,0 +1,20 @@ +# Test the interaction of metabase and database + +1. Follow the sections `Getting Started` of [metabase](https://github.com/building-envelope-data/metabase?tab=readme-ov-file#getting-started) + and [database](https://github.com/building-envelope-data/database?tab=readme-ov-file#getting-started). The sections use the repository + [machine](https://github.com/building-envelope-data/machine). +1. Within the project [machine](https://github.com/building-envelope-data/machine), + create a user for restricted areas like staging and email, for example with + `./deploy.mk user NAME=userRestrictedAreas`. +1. Register as metabase user + https://www.local.buildingenvelopedata.org:7001. +1. Use your account for restricted areas to open + https://www.local.buildingenvelopedata.org:7001/email/ . Open the registration email and use the link to confirm your metabase user account. +1. [Login in](https://www.local.buildingenvelopedata.org:7001/users/login) with + your metabase account. +1. [Create an institution](https://www.local.buildingenvelopedata.org:7001/institutions/create). + Use the UUID of the institution to verify the pending institution with + ``` + + ``` +1. Add a component, a method, a data format and a database to this institution. The database must include the URL of the GraphQL endpoint e.g. https://www.local.solarbuildingenvelopes.com:7501/graphql/ . Copy the UUIDs of the database and of your institution and paste it into the .env file of your `database` project. In the folder of your database, run `make down && make build up`. Sign in on https://www.local.solarbuildingenvelopes.com:7501/ with your metabase account. Create an optical dataset on https://www.local.solarbuildingenvelopes.com:7501/graphql/ using the mutation `createOpticalData`. List all pending optical datasets with the query `allPendingOpticalData`. Publish your optical dataset with the mutation `publishData`. Search your database for your optical dataset e.g. with the query `allOpticalData`. Search the metabase for your optical dataset e.g. with the query `databases{edges{node{allOpticalData`. \ No newline at end of file