Skip to content

Commit 7ea78b9

Browse files
onitakerohityadavcloud
authored andcommitted
README: add build dependencies to package.json and document production build properly (#21)
Fixes: #12 With build tooling added to the dev dependencies, it is no longer necessary to install system-wide. This is particularly useful for production builds, where system-wide package pollution is highly discouraged or even prohibited. npm@next, vue-cli and ncu may still be useful to developers, but they shouldn't be part of the build instructions. A separate readme update is on the way. The PR now also includes a readme update to clarify which tools should be installed when. Production builds do not need global tool installs. Signed-off-by: Rohit Yadav <[email protected]>
1 parent 1cbc501 commit 7ea78b9

File tree

3 files changed

+5049
-210
lines changed

3 files changed

+5049
-210
lines changed

ui/README.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ Install node: (CentOS/Fedora)
1515
curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
1616
sudo yum install nodejs
1717

18-
Install tools and dependencies:
18+
For development, install tools and dependencies system-wide:
1919

2020
sudo npm install -g @vue/cli webpack eslint
2121
sudo npm install -g npm@next
2222
sudo npm install -g npm-check-updates
23-
ncu -u # optional: upgrade dependencies
24-
npm install
2523

2624
## Development
2725

@@ -38,11 +36,7 @@ Build and run:
3836
or
3937
npm run serve
4038

41-
Production Build:
42-
43-
npm run build
44-
45-
Upgrade dependencies:
39+
Upgrade dependencies to the latest versions:
4640

4741
ncu -u
4842

@@ -56,6 +50,44 @@ Fix issues and vulnerabilities:
5650

5751
npm audit
5852

53+
## Production
54+
55+
Fetch dependencies and build:
56+
57+
npm install
58+
npm run build
59+
60+
This creates a static webpack application in `dist/`, which can then be served
61+
from any web server or CloudStack management server (jetty).
62+
63+
To use CloudStack management server (jetty), you may copy the built Primate build
64+
to a new/existing webapp directory on the management server host. If the webapp
65+
directory is changed, please change the `webapp.dir` in the
66+
`/etc/cloudstack/management/server.properties` and restart the management server host.
67+
68+
To use a separate webserver, note that the API server is accessed through the path
69+
`/client`, which needs be forwarded to an actual CloudStack instance.
70+
71+
For example, a simple way to serve Primate with nginx can be implemented with the
72+
following nginx configuration (to be put into /etc/nginx/conf.d/default.conf or similar):
73+
74+
```nginx
75+
server {
76+
listen 80;
77+
server_name localhost;
78+
location / {
79+
# /src/primate/dist contains the built Primate webpack
80+
root /src/primate/dist;
81+
index index.html;
82+
}
83+
location /client/ {
84+
# http://127.0.0.1:800 should be replaced your CloudStack management
85+
# server's actual URI
86+
proxy_pass http://127.0.0.1:8000;
87+
}
88+
}
89+
```
90+
5991
## Documentation
6092

6193
### Learning Resources

0 commit comments

Comments
 (0)