Skip to content

Commit

Permalink
Deploy starter kit
Browse files Browse the repository at this point in the history
  • Loading branch information
marob committed May 2, 2024
1 parent 3a7b9d7 commit dbf4b3c
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 1 deletion.
13 changes: 13 additions & 0 deletions deployment/ansible-vitamui-exploitation/start_vitamui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,19 @@
etat: started
tags: frontend_apps

# To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal
- hosts: hosts_ui_portal
gather_facts: no
roles:
- service_state
- check_port
vars:
vitamui_struct:
service_name: nginx
port_service: "{{ vitamui.starter_kit.port_service }}"
etat: started
tags: frontend_apps

### REVERSE
- hosts: hosts_vitamui_reverseproxy
gather_facts: no
Expand Down
13 changes: 13 additions & 0 deletions deployment/ansible-vitamui-exploitation/stop_vitamui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@
etat: stopped
tags: frontend_apps

# To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal
- hosts: hosts_ui_portal
gather_facts: no
roles:
- service_state
- check_port
vars:
vitamui_struct:
service_name: nginx
port_service: "{{ vitamui.starter_kit.port_service }}"
etat: stopped
tags: frontend_apps

## VITAMUI COMPONENTS

### CAS
Expand Down
9 changes: 9 additions & 0 deletions deployment/ansible-vitamui/frontend_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@
- nginx_webapp
vars:
vitamui_struct: "{{ vitamui.ingest }}"

# To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal
- hosts: hosts_ui_portal
gather_facts: no
any_errors_fatal: true
roles:
- nginx_webapp
vars:
vitamui_struct: "{{ vitamui.starter_kit }}"
3 changes: 3 additions & 0 deletions deployment/environments/group_vars/all/vitamui_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ vitamui:
pastis:
vitamui_component: ui-pastis
port_service: 9015
starter_kit:
vitamui_component: ui-starter-kit
port_service: 8004

# Applications
api_gateway:
Expand Down
1 change: 1 addition & 0 deletions deployment/pki/scripts/generate_certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function generateCerts {
generateHostCertAndStorePassphrase ui-archive-search hosts_ui_archive_search
generateHostCertAndStorePassphrase ui-collect hosts_ui_collect
generateHostCertAndStorePassphrase ui-pastis hosts_ui_pastis
generateHostCertAndStorePassphrase ui-starter-kit hosts_ui_portal

#Reverse
generateHostCertAndStorePassphrase reverse hosts_vitamui_reverseproxy
Expand Down
2 changes: 2 additions & 0 deletions deployment/pki/scripts/generate_certs_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function generateCerts {
generateHostCertAndStorePassphrase ui-archive-search hosts_ui_archive_search
generateHostCertAndStorePassphrase ui-pastis hosts_ui_pastis
generateHostCertAndStorePassphrase ui-collect hosts_ui_collect
generateHostCertAndStorePassphrase ui-starter-kit hosts_ui_portal

#Reverse
generateHostCertAndStorePassphrase reverse hosts_vitamui_reverseproxy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@
{% endfor %}
</div>
</p>
<p class="row" style="vertical-align: middle">
<div class="col-md-3">Starter kit</div>
<div class="col-md-9">
<a href="{{ url_prefix }}/starter-kit/" class="btn btn-primary btn-xs" target="_blank">Starter kit</a>
</div>
</p>
</div>
</div>
6 changes: 6 additions & 0 deletions deployment/roles/reverse/templates/apache/httpd_config
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,10 @@
ProxyPassReverse / {{ 'https' if vitamui.portal.secure | default(secure) | bool else 'http' }}://{{ hostvars[host]['ip_service'] }}:{{ vitamui.portal.port_service }}/
{% endfor %}

# STARTER KIT (To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal)
{% for host in groups['hosts_ui_portal'] %}
ProxyPass / {{ 'https' if vitamui.starter_kit.secure | default(secure) | bool else 'http' }}://{{ hostvars[host]['ip_service'] }}:{{ vitamui.starter_kit.port_service }}/ {{ reverse_connection_params }}
ProxyPassReverse / {{ 'https' if vitamui.starter_kit.secure | default(secure) | bool else 'http' }}://{{ hostvars[host]['ip_service'] }}:{{ vitamui.starter_kit.port_service }}/
{% endfor %}

</VirtualHost>
10 changes: 10 additions & 0 deletions deployment/roles/reverse/templates/nginx/conf.d/upstream.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ upstream PASTIS {
{% endfor %}
}
{% endif %}

# To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal
{% if groups['hosts_ui_portal']|length > 0 %}
upstream STARTER_KIT {
ip_hash;
{% for h in groups['hosts_ui_portal'] %}
server {{ hostvars[h].ip_service }}:{{ vitamui.starter_kit.port_service }};
{% endfor %}
}
{% endif %}
22 changes: 22 additions & 0 deletions deployment/roles/reverse/templates/nginx/conf.d/vhosts.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,28 @@ server {
}
{% endif %}

# To prevent creating a new hosts_ui_starter_kit host, we reuse hosts_ui_portal
{% if groups['hosts_ui_portal']|length > 0 %}
# STARTER KIT
location /starter-kit {
rewrite /starter-kit/(.*) /$1 break;
proxy_pass {{ 'https' if vitamui.starter_kit.secure | default(secure) | bool else 'http' }}://STARTER_KIT;

include {{ nginx_conf_dir }}/proxy_params;

# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering
# The request body is sent to the proxied server immediately as it is received.
proxy_request_buffering off;

# http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
# Sets the maximum allowed size of the client request body.
# If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client.
# Please be aware that browsers cannot correctly display this error.
# Setting size to 0 disables checking of client request body size.
client_max_body_size 0;
}
{% endif %}

# CAS SERVER
location = /cas {
return 302 $scheme://$host/cas/login;
Expand Down
1 change: 1 addition & 0 deletions ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<module>ui-archive-search</module>
<module>ui-pastis</module>
<module>ui-collect</module>
<module>ui-starter-kit</module>
</modules>

</project>
2 changes: 1 addition & 1 deletion ui/ui-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"build:pastis": "export NODE_OPTIONS=--max_old_space_size=1024; ng build pastis --prod --base-href=/pastis/ --deploy-url=/pastis/ --i18n-locale fr",
"build:pastis-standalone": "NODE_OPTIONS=--max_old_space_size=1024 ng build --configuration=standalone --i18n-locale fr --project=pastis",
"build:collect": "export NODE_OPTIONS=--max_old_space_size=1024; ng build collect --prod --base-href=/collect/ --deploy-url=/collect/ --i18n-locale fr",
"build:starter-kit": "export NODE_OPTIONS=--max_old_space_size=1024; ng build starter-kit --prod --base-href=/ --deploy-url=/ --i18n-locale fr",
"build:starter-kit": "export NODE_OPTIONS=--max_old_space_size=1024; ng build starter-kit --prod --base-href=/starter-kit/ --deploy-url=/starter-kit/ --i18n-locale fr",
"analyze-portal": "ng build portal --stats-json --prod ; webpack-bundle-analyzer dist/portal/stats.json",
"analyze-identity": "ng build identity --stats-json --prod --i18n-locale fr ; webpack-bundle-analyzer dist/identity/stats.json",
"analyze-referential": "ng build referential --stats-json --prod --i18n-locale fr ; webpack-bundle-analyzer dist/referential/stats.json",
Expand Down
40 changes: 40 additions & 0 deletions ui/ui-starter-kit/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ui-parent</artifactId>
<groupId>fr.gouv.vitamui</groupId>
<version>7.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ui-starter-kit</artifactId>
<packaging>jar</packaging>
<name>VITAMUI UI Starter kit</name>
<properties>
<angular.base.href>/starter-kit/</angular.base.href>
<angular.build.project>starter-kit</angular.build.project>
<rpm.skip>false</rpm.skip>
<rpm_rsc.skip>false</rpm_rsc.skip>
<webpack.skip>false</webpack.skip>
<webpack.test.skip>false</webpack.test.skip>
<skipTests>false</skipTests>
<skipAllFrontend>false</skipAllFrontend>
<skipAllFrontendTests>false</skipAllFrontendTests>
<jib.skip>true</jib.skip>
</properties>
<build>
<resources>
<resource>
<directory>target/www/</directory>
<targetPath>static/</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

0 comments on commit dbf4b3c

Please sign in to comment.