README.md 10.4 KB
Newer Older
cazenave's avatar
cazenave committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# VitamUI
VitamUI project.

# Prerequisites
- Install Java at least version 8
- Install Maven
- Install Git
- Install NodeJs
- Configure default registry:  npm config set registry https://registry.npmjs.org/
- Environment variable :
    - Vitam developer
        - Specify the environment variables : SERVICE_NEXUS_URL and SERVICE_REPOSITORY_URL
        - The maven command. Params between {} are optional: mvn clean install {-Ddependency-check.skip=true} -Denv.SERVICE_NEXUS_URL=... -Denv.SERVICE_REPOSITORY_URL=... {-DskipTests} -Pvitam
    - Non vitam developer
        - Build vitam locally @see  https://github.com/ProgrammeVitam/vitam/#id11


# Clone
Execute this command to clone the project from the bitbucket repo:

    git clone https://github.com/vitam-prg/vitamUI.git

# Global Maven profiles

Without a profile, only Java projects are build.
In order to build and package UI projects (i.e. Java backend & Angular frontend altogether), we use the plugin `frontend-maven-plugin` provided by `com.github.eirslett`.

## dev
This profile is used to build the entire project for dev purposes, backend & frontend included.
* UI modules are packaged with both Java & Angular.
* Angular projects are build without optimization in order to reduce global build time.
* Jasmine Karma tests are launched with the headless chrome.


## prod
This profile is used to build the entire project for prod purposes, backend/frontend included.
* UI modules are packaged with both Java & Angular.
* Angular projects are build with optimization.
* Jasmine Karma tests are launched with the headless chrome.


## npm-publish
This profile is used to build, test & push npm packages to the npm repository.
* It should be used in ui/ui-frontend-common to push the npm package of the common UI library.


## rpm
This profile is used to build rpm packages. Only Maven modules with `rpm.skip = false` in their properties are eligible.


## rpm-publish
This profile is used to push the generated rpm package. Only Maven modules with `rpm.skip = false` in their properties are eligible.


## skipTestsRun
This profile is automatically activated if the option `-DskipTests` is used during Maven execution in order to disable Jasmine Karma tests execution.


## sonar
This profile is used to update sonar informations.


## webpack
This profile is used to build the entire project, backend & frontend included.
* Angular projects are build without optimization in order to reduce global build time.
* Jasmine Karma tests are launched with the headless chrome.
* Jenkins can use this profile.

## swagger
This profile is used to generate the swagger.json draft file for swagger documentation. It's only needed for API modules.

## swagger-docs
This profile is used to generate .html & .pdf swagger documentation in tools/swagger/docs/.
* Only Maven modules with 'rpm.skip = false' in their properties are eligible.

## vitam
Profile to use for all Vitam internal developers


# Integration Tests Maven profiles

No integration test is launched during the _“normal”_ build of the project.
Integration tests need a full running environnement in order to launch API tests & few UI tests also.

## integration
This profile should be used to launch integration tests in Jenkins. The configuration used for the tests is available in `integration-tests/src/test/resources/application-integration.yml`

## dev-it
This profile should be used to launch integration tests in our development environment. The configuration used for the tests is available in `integration-tests/src/test/resources/application-dev.yml`

## iam
This profile should be used to launch API IAM integration tests in our development environment. The configuration used for the tests is available in `integration-tests/src/test/resources/application-dev.yml`

## security
This profile should be used to launch API Security integration tests in our development environment. The configuration used for the tests is available in `integration-tests/src/test/resources/application-dev.yml`

## front
This profile should be used to launch UI integration tests in our development environment. The configuration used for the tests is available in `integration-tests/src/test/resources/application-dev.yml`


# Build (first build)
Publish ui-frontend-common package. It's needed for angular projects ui-portal & ui-identity to compile.
Execute this command to build the project with unit tests and without building our angular projects:

    cd ui/ui-frontend-common;
    mvn clean install -Pnpm-publish

# Build (only Java)
Execute this command to build the project with unit tests and without building our angular projects:

    mvn clean install

## Build (only Java) without test
Execute this command to build the project without unit tests and without building our angular projects:

    mvn clean install -DskipTests

## Build with IHM (JS) in dev mode
Use the dev maven profile to build the project with our angular projects.
For our angular projects, the build doesn't generate the sourcemap and doesn't optimize the build.
For the karma tests, we don't generate the code coverage and use the headless chrome.

    mvn clean install -Pdev

## Build with IHM (JS) for our Jenkins
Use the webpack maven profile to build the project with our angular projects.
For our angular projects, the build generate the sourcemap and doesn't optimize the build.
For the karma tests, we don't generate the code coverage and use the headless chrome.

    mvn clean install -Pwebpack

## Build with IHM (JS) for our Production environment
Use the webpack maven profile to build the project with our angular projects.
For our angular projects, the build generate the sourcemap and optimize the build.
For the karma tests, we don't generate the code coverage and use the headless chrome.

    mvn clean install -Pprod


If `-DskipTests` id added during the build of dev, webpack or prod, unit tests and karma tests are both ignored.


## Integration tests
Use the integration-tests maven profile to build the project with unit tests and integration tests

    mvn clean verify -Pdev-it

For more details see [README](integration-tests/README.md) in integration-tests module.

## Package to RPM
Use the RPM maven profile to build the project and package to RPM:

    mvn clean package -Prpm,webpack

## Execute Integration tests

    mvn clean verify -Pintegration

## Execute sonar report

    mvn clean verify -Psonar
You can specify properties to change URL and login to sonar:

    mvn clean verify -Psonar \
        -Dsonar.host.url=http://localhost:9000 \
        -Dsonar.login=<TOKEN AUTHENTICATION>


## Deploy artifact
To build all artifacts and deploy to NEXUS use:

    mvn clean deploy -Prpm,webpack

## Swagger
To generate swagger.json use:

    mvn test -Pswagger

To edit swagger.json you can use this website:

    https://editor.swagger.io/

To generate index.pdf and index.html from `swagger.json`:

     mvn generate-resources -Pswagger-docs

# Lancement de VITAMUI des versions

Current version of VITAMUI depends on Ansible version 2.7.0.

In order not to interfere with more recent Ansible version, deploy a Python VirtualEnv
in which you install Ansible 2.7.0:
 * Check that VirtualEnv executable is installed: `apt-get install python-virtualenv`
 * In a directory of your choice, create the virtual environment: `virtualenv vitamUI-ansible`
 * Activate the environment `. virtamUI-ansible/bin/activate`
 * Install Ansible 2.7.0: `pip install ansible==2.7.0`
 * Check the version of ansible: `ansible --version`

Autre possibilité, Ansible version 2.7.0 doit être installé pour lancer le script mongo:
* Si une version d'ansible à été installé via apt-get install, il est nécessaire de la sésinstaller `apt-get remove ansible`
* Installer pip `apt-get install -y python-pip`
* Installer ansible via pip `pip install ansible==2.7.0`
* Vérifier que l'installation c'est bien déroulée `ansible --version`
* Il est possible que l'ajout du lien vers ansible dans le PATH et/ou qu'un redémarage soit nécessaire

### 1 - Démarrage du Mongo VITAMUI

```
├── tools
│   ├── docker
│   │   ├── mongo: './restart_dev.sh'
```

### 2 - Lancement de l'application SpringBoot Security-Internal

```
│   ├── api-security
│   │   ├── security-internal: 'mvn clean spring-boot:run' ou './run.sh'
```

### 3 - Lancement de l'application SpringBoot IAM-Internal

```
├── api
│   ├── api-iam
│   │   ├── iam-internal: 'mvn clean spring-boot:run' ou './run.sh'
```

### 4 - Lancement de l'application SpringBoot IAM-External

```
├── api
│   ├── api-iam
│   │   ├── iam-external: 'mvn clean spring-boot:run'
                        ou './run.sh'
```

### 5 - Lancement de l'application CAS Server. La surcharge faite sur CAS nous empêche de lancer avec le plugin spring-boot

**CAS-Server dépend de security-internal, iam-internal & iam-external**

```
├── cas
│   ├── cas-server: './run.sh'
```

## Scénario 1 : utilisation en dev

### 6a - Lancement de l'application SpringBoot correspondant au back de UI-Portal

```
└── ui
    └── ui-portal: 'mvn clean spring-boot:run'
```

### 6b - Lancement de l'application Angular UI-Portal

```
└── ui
    ├── ui-frontend: 'npm run start:portal'
```

### 7a - Lancement de l'application SpringBoot correspondant au back de UI-Identity

```
└── ui
    └── ui-identity: 'mvn clean spring-boot:run'
```

### 7b - Lancement de l'application Angular UI-Identity

```
└── ui
    ├── ui-frontend: 'npm run start:identity'
```

## Scénario 2 : utilisation en mode recette : Une compilation avec `-Pwebpack` a été effectuée.
**Attention les JAR doivent contenir les pages et scripts de la partie UI Frontend généré avec ng build.**


### 6 - Lancement de l'application SpringBoot correspondant au back de UI-Portal

```
└── ui
    └── ui-portal: './run.sh'
```

### 7 - Lancement de l'application SpringBoot correspondant au back de UI-Identity

```
└── ui
    └── ui-identity : './run.sh'
```

### 8. Les certificats sont auso-signés, il faut accepter les certificats dans le navigateur pour :

**Attention : sans cette étape, le logout sur toutes les applications par CAS ne fonctionne pas**

UI-Frontend

* https://dev.vitamui.com:4200

* https://dev.vitamui.com:4201/user

Ui-Back

* https://dev.vitamui.com:9000/

* https://dev.vitamui.com:9001/

### 9. Se connecter sur le portail via
* https://dev.vitamui.com:4200