APS_NodeJS_MultiModel/README.md

203 lines
6.2 KiB
Markdown
Raw Normal View History

2024-11-24 08:52:39 +01:00
<!--
*** DanieleViero
*** §§§§§§§§§§§§§§§§§§§§§§§§§§§§_-Main readme template-_§§§§§§§§§§§§§§§§§§§§§§§§§§
*** Make sure to use this as initiate on all projects. Must be used along with the
*** .gitignore provided as a template
*** contact ref
*** user@domain.com
*** user@domain.com
*** user@domain.com
*** user@domain.com
-->
<!--
*** using ref style capability
*** for more info: https://www.markdownguide.org/basic-syntax/#reference-style-links
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** bottom of document for the declaration of the reference variables
***
-->
<!-- Header quick ref -->
![Development][Development]
<!-- COMPANY LOGO -->
<br />
<div align="center">
<a href="null">
<img src="img/gruner.png" alt="Logo" width="260" height="170">
</a>
<h3 align="center">Website viewer APS</h3>
<p align="center">
------ Website viewer Autodesk Platform Services driven -----
</p>
</div>
<!-- TABLE OF CONTENTS -->
<!-- REMOVE IF NOT RELEVANT -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#project-description">Project Description</a>
</li>
<li>
<a href="#getting-started">Getting Started</a>
</li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#contact">Contact</a></li>
</ol>
</details>
<!-- ABOUT THE PROJECT -->
## Project Description
APS model viewer implementation for marketing purposes.
<a href="https://webapps.gruner.ch">
<img src="img/thumbnail.png" alt="Logo" width="400">
</a>
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- GETTING STARTED -->
## Getting Started
The Viewer is setup to be deployed with docker. Nevertheless it can be run standalone by installing nodejs on the target machine.
If standalone, only the `.env` has to be created and populated. All other steps can be skipped.
## Setup procedure for dmzlxv09.dmz.gruner.ch aka webapps.gruner.ch
### Docker Setup
- clone the Repo
- Create a _.env_ file in the project folder (from .env_sample), and populae it with the snippet below,
replacing `<client-id>` and `<client-secret>` with your APS Client ID and Client Secret
- upload the model via [OSS Manager](https://oss-manager.autodesk.io/) and insert the filename of the model `presetModel= `
```bash
APS_CLIENT_ID=<INSERT ID>
APS_CLIENT_SECRET=<INSERT SECRET>
APS_BUCKET=
presetModel=BPZ_00_GRU_SIT_STR_MOD_EXI_Powerhouse.rvt # Insert filename of the model
```
- edit `docker-compose.yml` and change the port.
```yml
ports:
- "127.0.0.1:808X:8080"
```
- edit the
- Run the application, `docker compose up -d` in terminal
- Open http://localhost:808X
### NGINX Setup
1. Edit the `sudo nano /etc/nginx/nginx.conf`.
```js
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
proxy_pass http://127.0.0.1:8080;
}
location ~/test(.*)$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8081/$1;
}
...
```
- copy the `location ~/test..`
- adjust the path to your liking
- adjust `proxy_pass http://127.0.0.1:808X/$1;`port to the port configured in your docker-compose.yml
2. reload nginx to activate the new configuration `sudo systemctl reload nginx.service`.
The viewer should now be displaying the Model on the configured URL.
### ASP Documentation
- [Link1](https://aps.autodesk.com/apis-and-services/viewer)
- [Link2](https://aps.autodesk.com/developer/overview/viewer-sdk)
- [Link3](https://aps.autodesk.com/en/docs/viewer/v7/developers_guide/overview/)
<!-- CONTRIBUTING -->
## Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
<p align="right">(<a href="#readme-top">back to top</a>)</p>
<!-- CONTACT -->
## Authors
Daniele Viero - daniele.viero@gruner.ch
David Friedrich - david.friedrich@gruner.ch
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[DepICT]: https://img.shields.io/badge/DEP-ICT-brightgreen
[DepICT-url]: https://gruner.sharepoint.com/sites/gn-su/SitePages/BSC_ICT.aspx
[DepBIM]: https://img.shields.io/badge/DEP-BIM-orange
[DepBIIM]: https://img.shields.io/badge/DEP-BIIM-orange
[DepBIM-url]: https://gruner.sharepoint.com/sites/intranet/SitePages/en/Home.aspx
[DepINFOM]: https://img.shields.io/badge/DEP-INFOMANAGEMENT-yellowgreen
[DepINFOM-url]: https://gruner.sharepoint.com/sites/intranet/SitePages/en/Home.aspx
[DepDATAM]: https://img.shields.io/badge/DEP-DATAMANAGEMENT-blue
[DepDATAM-url]: https://gruner.sharepoint.com/sites/intranet/SitePages/en/Home.aspx
[Integration]: https://img.shields.io/badge/-Integration-blue
[Automation]: https://img.shields.io/badge/-Automation-brightgreen
[Development]: https://img.shields.io/badge/-Development-yellow
[Support]: https://img.shields.io/badge/-Support-red
[Token]: https://img.shields.io/badge/-TOKEN-orange
## Development
### Prerequisites
- [APS credentials](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/create-app)
- [Node.js](https://nodejs.org) (Long Term Support version is recommended)
- Command-line terminal such as [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/overview)
or [bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) (should already be available on your system)
> We recommend using [Visual Studio Code](https://code.visualstudio.com) which, among other benefits,
> provides an [integrated terminal](https://code.visualstudio.com/docs/terminal/basics) as well.
## Troubleshooting
## License
This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Please see the [LICENSE](LICENSE) file for more details.