This document describes how to deploy an ADF Angular app.
The first task before to deploy your project is to produce a distribution build. Move to the main folder of your project before proceeding.
The result of this build is not optimized for production. The total sizes of the bundles are big because they contain unused code and have not been minified. However, this kind of build is useful in the development phase to debug your application.
ng build
This command will produce a dist folder in your project folder. If you want to change the output folder you can use the command :
ng build -op OUTPUT_FOLDER
The result of this build is optimized for production. The total bundle sizes are smaller because the build makes use of a number of optimizations: AOT, Bundling, Minification, Uglification, and Dead code elimination. To learn more about this process please refer to the official Angular CLI documentation build · angular/angular-cli Wiki · GitHub
ng build --prod
This command will produce a dist folder in your project folder. If you want to change the output folder you can use the command :
ng build -op OUTPUT_FOLDER
Once the dist folder has been created it will contain the app.confg.json file that was originally in your main folder. Before proceeding with the deployment of your app, check that the configuration of app.config.json correctly targets your backend content services and/or process services.
See this document to find out how to set up different configurations for different environments: https://community.alfresco.com/people/eugenio_romano/blog/2018/03/07/how-to-organize-your-adf-appcon...
After your dist folder has been created, the next steps are:
The server fallback is needed to ask the server to return the index.html page when asked for a route or file that does not exist. These URLs will be interpreted by the Angular router
In the next part of this document we describe how to execute the two steps above for different server types:
<Context path="/" docBase="dist">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
Edit your /etc/nginx/nginx.conf file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html;
}
}
}
(Note my-new-project-7e300 is the same id created above)
If you experience cross-domain requests problems then check this guide for advice on how to solve them: https://community.alfresco.com/community/application-development-framework/blog/2017/06/20/adf-cors-...
If you have any questions then feel free to reply here or contact us using gitter .