Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:dev:creating_a_development_environment [2023/09/19 08:29] kotynekv [3. Install PostgreSQL] Ubuntu postgres |
tutorial:dev:creating_a_development_environment [2024/01/09 08:25] koulaj |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Creating a development environment ====== | ====== Creating a development environment ====== | ||
- | This text is intended as a tutorial for CzechIdM developers with the goal to set up IDE, build CzechIdM in it and run the system. If you prefer quick glance at the code or need to start quickly, you can use [[tutorial: | + | This text is intended as a tutorial for CzechIdM developers with the goal to set up IDE, build CzechIdM in it and run the system. If you prefer quick glance at the code or need to start quickly, you can use [[.: |
====== 1. Install Java and Maven ====== | ====== 1. Install Java and Maven ====== | ||
Line 7: | Line 7: | ||
First install JDK and Maven: | First install JDK and Maven: | ||
- | Download and install Java 11 OpenJDK. | + | Download and install Java 11 OpenJDK |
Install Maven from your system packages, at least version 3.1 is required. | Install Maven from your system packages, at least version 3.1 is required. | ||
+ | |||
<code bash> | <code bash> | ||
yum install maven | yum install maven | ||
mvn -v | mvn -v | ||
+ | |||
</ | </ | ||
Note: If you installed Java separately from your system libraries, you should set the correct Java home for Maven in the file " | Note: If you installed Java separately from your system libraries, you should set the correct Java home for Maven in the file " | ||
< | < | ||
+ | |||
export JAVA_HOME=/ | export JAVA_HOME=/ | ||
+ | |||
</ | </ | ||
+ | |||
This way Maven will always use this JDK. | This way Maven will always use this JDK. | ||
Line 27: | Line 32: | ||
<code bash> | <code bash> | ||
git clone https:// | git clone https:// | ||
+ | |||
</ | </ | ||
- | Check branch: | + | Check branch: |
<code bash> | <code bash> | ||
git branch | git branch | ||
+ | |||
</ | </ | ||
Line 39: | Line 46: | ||
<code bash> | <code bash> | ||
git checkout -b develop origin/ | git checkout -b develop origin/ | ||
+ | |||
</ | </ | ||
Line 45: | Line 53: | ||
<code bash> | <code bash> | ||
git checkout -b personal/ | git checkout -b personal/ | ||
+ | |||
</ | </ | ||
Line 54: | Line 63: | ||
Install necessary packages: | Install necessary packages: | ||
+ | |||
<code bash> | <code bash> | ||
yum install postgresql postgresql-server postgresql-init | yum install postgresql postgresql-server postgresql-init | ||
+ | |||
</ | </ | ||
Fedora 25 packages: | Fedora 25 packages: | ||
+ | |||
<code bash> | <code bash> | ||
dnf install postgresql-server postgresql-contrib | dnf install postgresql-server postgresql-contrib | ||
+ | |||
</ | </ | ||
Ubuntu 22.04 LTS packages: | Ubuntu 22.04 LTS packages: | ||
+ | |||
<code bash> | <code bash> | ||
apt install postgresql postgresql-contrib | apt install postgresql postgresql-contrib | ||
+ | |||
</ | </ | ||
First run of the service: | First run of the service: | ||
+ | |||
<code bash> | <code bash> | ||
systemctl start postgresql.service | systemctl start postgresql.service | ||
+ | |||
</ | </ | ||
- | If the following error occurs: "Job for postgresql.service failed. See ' | + | If the following error occurs: "Job for postgresql.service failed. See ' |
- | Try initializing the PostgreSQL first and start the database again: | + | |
<code bash> | <code bash> | ||
postgresql-setup --initdb --unit postgresql | postgresql-setup --initdb --unit postgresql | ||
+ | |||
</ | </ | ||
Set automatic start of the service when starting OS: | Set automatic start of the service when starting OS: | ||
+ | |||
<code bash> | <code bash> | ||
systemctl enable postgresql.service | systemctl enable postgresql.service | ||
+ | |||
</ | </ | ||
Set the configuration file for the database to accept login and password (change METHOD from ident to md5) | Set the configuration file for the database to accept login and password (change METHOD from ident to md5) | ||
+ | |||
< | < | ||
vim / | vim / | ||
Line 91: | Line 111: | ||
in Ubuntu it is: | in Ubuntu it is: | ||
vim / | vim / | ||
+ | |||
+ | in Windows it is: | ||
+ | < | ||
# TYPE DATABASE | # TYPE DATABASE | ||
Line 100: | Line 123: | ||
# IPv6 local connections: | # IPv6 local connections: | ||
host | host | ||
+ | |||
</ | </ | ||
Restart the service to load the changes: | Restart the service to load the changes: | ||
+ | |||
< | < | ||
systemctl restart postgresql.service | systemctl restart postgresql.service | ||
+ | |||
</ | </ | ||
Create the database with name: | Create the database with name: | ||
+ | |||
* Version 10 - bcv\_idm\_10 | * Version 10 - bcv\_idm\_10 | ||
* Below version 10 - bcv\_idm\_storage | * Below version 10 - bcv\_idm\_storage | ||
Line 116: | Line 143: | ||
CREATE USER idmadmin PASSWORD ' | CREATE USER idmadmin PASSWORD ' | ||
CREATE DATABASE " | CREATE DATABASE " | ||
+ | |||
</ | </ | ||
Line 122: | Line 150: | ||
The tutorial is different for each IDE. Select one and continue with a certain tutorial below: | The tutorial is different for each IDE. Select one and continue with a certain tutorial below: | ||
- | * [[devel: | + | * [[:devel: |
- | * [[devel: | + | * [[:devel: |
In the IDE start the Tomcat server with CzechIdM deployed. | In the IDE start the Tomcat server with CzechIdM deployed. | ||
Line 129: | Line 157: | ||
In browser access [[http:// | In browser access [[http:// | ||
- | > CzechIdM API is running | + | > CzechIdM API is running |
- | > | + | |
- | > If you can see this message, API is running | + | |
====== 5. Frontend development environment ====== | ====== 5. Frontend development environment ====== | ||
- | <note important> | + | <note important> |
===== Select IDE for frontend environment ===== | ===== Select IDE for frontend environment ===== | ||
You can use any text editor or JavaScript IDE. We recommend to use ATOM | You can use any text editor or JavaScript IDE. We recommend to use ATOM | ||
- | | + | |
+ | | ||
====== 6. Run backend and frontend together ====== | ====== 6. Run backend and frontend together ====== | ||
Line 153: | Line 180: | ||
cd CzechIdM/ | cd CzechIdM/ | ||
gulp | gulp | ||
+ | |||
</ | </ | ||
- | A new browser window or tab will open with [[https:// | + | A new browser window or tab will open with [[https:// |
The frontend is fully started after you see in following line in log: | The frontend is fully started after you see in following line in log: | ||
Line 161: | Line 189: | ||
<code bash> | <code bash> | ||
[BS] 1 file changed (app.js) | [BS] 1 file changed (app.js) | ||
+ | |||
</ | </ | ||
After the application is running, log in: | After the application is running, log in: | ||
+ | |||
* username: admin | * username: admin | ||
* password: admin | * password: admin | ||
- | <note tip>If the app shows error with permission, log out</ | + | <note tip>If the app shows error with permission, log out</ |
- | <note tip>To use CzechIdM in more windows or tabs for development purposes go to [[http:// | + | |
Congratulations! Your CzechIdM development environment is ready to use. | Congratulations! Your CzechIdM development environment is ready to use. | ||
- | |||
====== Common development errors & tips ====== | ====== Common development errors & tips ====== | ||
Line 178: | Line 206: | ||
If Tomcat server fails to start, try following: | If Tomcat server fails to start, try following: | ||
- | | + | |
+ | | ||
* Check that PostgreSQL server is running. | * Check that PostgreSQL server is running. | ||
+ | |||
<code bash> | <code bash> | ||
systemctl status postgresql.service | systemctl status postgresql.service | ||
+ | |||
</ | </ | ||
- | | + | |
+ | | ||
< | < | ||
+ | |||
spring.datasource.url=jdbc: | spring.datasource.url=jdbc: | ||
spring.datasource.username=idmadmin | spring.datasource.username=idmadmin | ||
spring.datasource.password=idmadmin | spring.datasource.password=idmadmin | ||
+ | |||
</ | </ | ||
+ | |||
use the following command and type the password when asked for it. | use the following command and type the password when asked for it. | ||
+ | |||
<code bash> | <code bash> | ||
psql -h 127.0.0.1 -U idmadmin bcv_idm_storage | psql -h 127.0.0.1 -U idmadmin bcv_idm_storage | ||
+ | |||
</ | </ | ||
+ | |||
* Check that you can read from the tables of the database. As in the previous point, connect to the PostgreSQL database and try to select data from any of the IdM tables. If you have insufficient access rights, check the owner and grants for the schema " | * Check that you can read from the tables of the database. As in the previous point, connect to the PostgreSQL database and try to select data from any of the IdM tables. If you have insufficient access rights, check the owner and grants for the schema " | ||
* Check the error message in the server output console. | * Check the error message in the server output console. | ||
Line 198: | Line 236: | ||
==== Common error messages ==== | ==== Common error messages ==== | ||
- | '' | + | '' |
- | '' | + | '' |
< | < | ||
+ | |||
Offenders: | Offenders: | ||
-> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/ | -> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/ | ||
-> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/ | -> ... idm-core-impl-7.7.0-SNAPSHOT.jar!/ | ||
+ | |||
</ | </ | ||
+ | |||
Just increase the version in the name of one of the scripts, clean & build the project again. | Just increase the version in the name of one of the scripts, clean & build the project again. | ||
- | |||
=== Could not create Vfs.Dir from url === | === Could not create Vfs.Dir from url === | ||
+ | |||
**This isn't error just warning**. You may don't interest about this warning. Warning is only when you start local development environment and you configuration for ic connectors path isn't correctly setup. Dont worry about this warning. | **This isn't error just warning**. You may don't interest about this warning. Warning is only when you start local development environment and you configuration for ic connectors path isn't correctly setup. Dont worry about this warning. | ||
Line 217: | Line 258: | ||
org.reflections.ReflectionsException: | org.reflections.ReflectionsException: | ||
either use fromURL(final URL url, final List< | either use fromURL(final URL url, final List< | ||
+ | |||
</ | </ | ||
Line 224: | Line 266: | ||
If your gulp build fails with the following error: | If your gulp build fails with the following error: | ||
+ | |||
< | < | ||
[INFO] [18:43:00] Starting ' | [INFO] [18:43:00] Starting ' | ||
Line 241: | Line 284: | ||
[ERROR] Allocation failed - process out of memory | [ERROR] Allocation failed - process out of memory | ||
[ERROR] 1: node:: | [ERROR] 1: node:: | ||
+ | |||
</ | </ | ||
Try following: | Try following: | ||
- | | + | |
- | * If you build BE+FE of a project together, check the '' | + | |
+ | * If you build BE+FE of a project together, check the '' | ||
< | < | ||
- | < | + | |
- | < | + | |
- | < | + | < |
- | < | + | < |
- | </ | + | < |
- | < | + | </ |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | </ | + | < |
- | </ | + | </ |
+ | </ | ||
</ | </ | ||
- | | + | |
+ | | ||
< | < | ||
< | < | ||
Line 274: | Line 322: | ||
</ | </ | ||
</ | </ | ||
+ | |||
</ | </ | ||
==== Wrong layout and NPM version ==== | ==== Wrong layout and NPM version ==== | ||
- | If your frontend looks like this: https:// | + | If your frontend looks like this: [[https:// |
- | * there is package-lock.json file in the frontend app module and it looks like this: https:// | + | |
+ | * there is package-lock.json file in the frontend app module and it looks like this: [[https:// | ||
* NPM version which you use when building frontend (or FE+BE) is at least 6. | * NPM version which you use when building frontend (or FE+BE) is at least 6. | ||
< | < | ||
+ | |||
npm -v | npm -v | ||
6.4.1 | 6.4.1 | ||
+ | |||
</ | </ | ||