Skip to content

Commit 16dc69d

Browse files
committed
update
0 parents  commit 16dc69d

File tree

152 files changed

+35166
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+35166
-0
lines changed

.github/workflows/build.yml

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: Docker Demo on Self-Hosted Runner
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
run-in-paris:
10+
name: Run on Paris Runner
11+
runs-on: [self-hosted, paris]
12+
steps:
13+
- name: Fix permissions before checkout
14+
run: sudo chown -R $USER:$USER $GITHUB_WORKSPACE
15+
16+
- name: Force delete previous build artifacts
17+
run: sudo rm -rf $GITHUB_WORKSPACE/* || true
18+
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
with:
22+
ref: main
23+
clean: true
24+
25+
- name: Create hoops_license.txt
26+
run: |
27+
echo "${{ secrets.HOOPS_LICENSE }}" | base64 --decode > hoops_license.txt
28+
ls -l hoops_license.txt # Verify file exists
29+
cat hoops_license.txt # Debugging: Check file content (remove in production)
30+
31+
- name: Inject Host IP into index.html
32+
run: |
33+
sed -i 's|<head>|<head>\n<script>window.HOST_IP="${{ secrets.HOST_IP }}";</script>|' ./public/index.html
34+
35+
- name: Write SSL certificates to files
36+
run: |
37+
pwd # Print the current working directory
38+
ls -la # List files before creating certs
39+
mkdir -p certs
40+
echo "${{ secrets.SSL_CERT }}" > certs/server.crt
41+
echo "${{ secrets.SSL_KEY }}" > certs/server.key
42+
echo "${{ secrets.CA_CERT }}" > certs/ca.crt
43+
44+
- name: Verify SSL Certificates
45+
run: |
46+
echo "🔍 Checking SSL certificate files..."
47+
if [ ! -s certs/server.crt ] || [ ! -s certs/server.key ]; then
48+
echo "❌ Error: SSL certificate files are missing or empty!"
49+
exit 1
50+
fi
51+
ls -la certs/
52+
53+
- name: Set Environment Variable for Docker
54+
run: echo "HOST_IP=${{ secrets.HOST_IP }}" >> $GITHUB_ENV
55+
56+
- name: Login to GitHub Packages
57+
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
58+
59+
- name: Remove unused Docker images
60+
run: docker image prune -af
61+
62+
- name: Pull Latest Docker Images
63+
run: |
64+
docker pull ghcr.io/techsoft3d/streaming-server:latest
65+
docker pull ghcr.io/techsoft3d/node-server:latest
66+
docker pull ghcr.io/techsoft3d/proxy-server:latest
67+
68+
- name: Copy `./public` into External Docker Volume (Using Temporary Container)
69+
run: |
70+
docker run --rm \
71+
-v public:/volume \
72+
-v $(pwd)/public:/backup \
73+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
74+
75+
docker run --rm \
76+
-v patches:/volume \
77+
-v $(pwd)/patches:/backup \
78+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
79+
docker run --rm \
80+
-v models:/volume \
81+
-v $(pwd)/models:/backup \
82+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
83+
84+
85+
86+
- name: Build and Run Docker Containers
87+
run: |
88+
docker-compose -p main_project up -d --force-recreate
89+
90+
91+
run-in-oregon:
92+
name: Run on Oregon Runner
93+
runs-on: [self-hosted, oregon]
94+
steps:
95+
- name: Fix permissions before checkout
96+
run: sudo chown -R $USER:$USER $GITHUB_WORKSPACE
97+
98+
- name: Force delete previous build artifacts
99+
run: sudo rm -rf $GITHUB_WORKSPACE/* || true
100+
101+
- name: Checkout repository
102+
uses: actions/checkout@v3
103+
with:
104+
ref: main
105+
clean: true
106+
107+
- name: Create hoops_license.txt
108+
run: |
109+
echo "${{ secrets.HOOPS_LICENSE }}" | base64 --decode > hoops_license.txt
110+
ls -l hoops_license.txt # Verify file exists
111+
cat hoops_license.txt # Debugging: Check file content (remove in production)
112+
113+
- name: Inject Host IP into index.html
114+
run: |
115+
sed -i 's|<head>|<head>\n<script>window.HOST_IP="${{ secrets.HOST_IP }}";</script>|' ./public/index.html
116+
117+
- name: Write SSL certificates to files
118+
run: |
119+
pwd # Print the current working directory
120+
ls -la # List files before creating certs
121+
mkdir -p certs
122+
echo "${{ secrets.SSL_CERT }}" > certs/server.crt
123+
echo "${{ secrets.SSL_KEY }}" > certs/server.key
124+
echo "${{ secrets.CA_CERT }}" > certs/ca.crt
125+
126+
- name: Verify SSL Certificates
127+
run: |
128+
echo "🔍 Checking SSL certificate files..."
129+
if [ ! -s certs/server.crt ] || [ ! -s certs/server.key ]; then
130+
echo "❌ Error: SSL certificate files are missing or empty!"
131+
exit 1
132+
fi
133+
ls -la certs/
134+
135+
- name: Set Environment Variable for Docker
136+
run: echo "HOST_IP=${{ secrets.HOST_IP }}" >> $GITHUB_ENV
137+
138+
- name: Login to GitHub Packages
139+
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
140+
141+
- name: Remove unused Docker images
142+
run: docker image prune -af
143+
144+
- name: Pull Latest Docker Images
145+
run: |
146+
docker pull ghcr.io/techsoft3d/streaming-server:latest
147+
docker pull ghcr.io/techsoft3d/node-server:latest
148+
docker pull ghcr.io/techsoft3d/proxy-server:latest
149+
150+
- name: Copy `./public` into External Docker Volume (Using Temporary Container)
151+
run: |
152+
docker run --rm \
153+
-v public:/volume \
154+
-v $(pwd)/public:/backup \
155+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
156+
157+
docker run --rm \
158+
-v patches:/volume \
159+
-v $(pwd)/patches:/backup \
160+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
161+
docker run --rm \
162+
-v models:/volume \
163+
-v $(pwd)/models:/backup \
164+
alpine sh -c "cp -r /backup/* /volume/ && ls -la /volume/"
165+
166+
167+
168+
- name: Build and Run Docker Containers
169+
run: |
170+
docker-compose -p main_project up -d --force-recreate

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hoops_license.txt
2+
/certs
3+
/public/hoops

Readme.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Four Models
2+
This repo will walk you through the steps to run a HOOPS Communicator based Linux Streaming Server Docker Container and a companion node-server for static files.
3+
4+
## Getting Stated
5+
1. If you do not already have one, create a github token. This can be done here: https://github.com/settings/tokens. Be sure to give yourself full repo acces and write:packages access.
6+
7+
## Open a terminal and run the following commands to pull the docker containers
8+
1. ```echo <your_github_token> | docker login ghcr.io -u <yourGitHubUserName> --password-stdin```
9+
2. ```docker pull ghcr.io/techsoft3d/streaming-server:latest```
10+
3. ```docker pull ghcr.io/techsoft3d/node-server:latest```
11+
12+
## Add your HOOPS License
13+
1. Create a file called hoops_license.txt in the root directory of this project
14+
2. Place your license key string in this file without any quotes
15+
16+
## Change to use IP of host server (or localhost if running locally)
17+
1. Update line 67 of index.html ```var server = new ServerConnection("http://<host_ip>:11182");```
18+
19+
2. Update line 39 of server_config.js ```publicHostname: "<host_ip>```
20+
21+
## Add additional models
22+
1. Place any additional models that you'd like to stream inside of the models directory. These models must be compatible with HC 2025.1.0 or older
23+
24+
## Start Docker Containers
25+
1. From within the root folder of your GitHub repo run ```docker-compose up -d --force-recreate```
26+
* If you do not have docker installed it can be installed from the [docker website](https://www.docker.com/get-started/)
27+
28+
## View template application
29+
1. Open a browser window and navigate to ```http://localhost:3000```
30+

docker-compose.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: '3'
2+
3+
services:
4+
hoops:
5+
image: ghcr.io/techsoft3d/streaming-server:latest
6+
container_name: hoops
7+
restart: unless-stopped
8+
ports:
9+
- "11182:11182"
10+
- "11000-11034:11000-11034"
11+
volumes:
12+
- "./patches/server_config.js:/opt/hoops_communicator/quick_start/server_config.js"
13+
- "./patches/Utils.js:/opt/hoops_communicator/server/node/lib/Utils.js"
14+
- models:/opt/hoops_communicator/models
15+
- "./hoops_license.txt:/opt/hoops_communicator/hoops_license.txt"
16+
- public:/opt/public # Shared volume to copy files
17+
18+
environment:
19+
- HOST_IP=${HOST_IP}
20+
networks:
21+
- shared-network
22+
command: ["/bin/sh", "-c", "
23+
echo 'Copying HOOPS files to public/hoops...' &&
24+
mkdir -p /opt/public/hoops &&
25+
cp /opt/hoops_communicator/web_viewer/deprecated/src/js/hoops_web_viewer.js /opt/public/hoops/ &&
26+
cp /opt/hoops_communicator/web_viewer/deprecated/src/js/engine-wasm.js /opt/public/hoops/ &&
27+
cp /opt/hoops_communicator/web_viewer/deprecated/src/js/engine-asmjs.js /opt/public/hoops/ &&
28+
cp /opt/hoops_communicator/web_viewer/deprecated/src/js/engine.wasm /opt/public/hoops/ &&
29+
echo 'Copy complete. Starting Streaming Server...' &&
30+
exec ../../3rd_party/node/bin/node --expose-gc ./lib/Startup.js --config-file ../../quick_start/server_config.js"]
31+
app:
32+
image: ghcr.io/techsoft3d/node-server:latest
33+
container_name: file-server
34+
restart: unless-stopped
35+
ports:
36+
- "3000:3000" #change to whatever port you want files to be served from, but default is 3000
37+
environment:
38+
- PORT=3000 # This sets the PORT dynamically
39+
volumes:
40+
- public:/app/public # Mounts local "public" folder into the container
41+
depends_on:
42+
- hoops
43+
networks:
44+
- shared-network
45+
46+
proxy-server:
47+
image: ghcr.io/techsoft3d/proxy-server:latest
48+
container_name: proxy-server
49+
restart: unless-stopped
50+
ports:
51+
- "443:443"
52+
depends_on:
53+
- hoops
54+
networks:
55+
- shared-network
56+
volumes:
57+
- ./certs:/app/certs
58+
networks:
59+
shared-network:
60+
external: true
61+
62+
volumes:
63+
public:
64+
external: true
65+
# patches:
66+
# external: true
67+
models:
68+
external: true

models/01-2_block_v.scz

2.85 MB
Binary file not shown.

models/EnginePoints.scz

28.7 MB
Binary file not shown.

modify.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

patches/Utils.js

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)