Skip to content

Commit 425c468

Browse files
committed
infra: add start setup for gpu server
1 parent 7f65cc7 commit 425c468

5 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_KEY=<TensorDock_API_KEY>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=AggregationMode Start
3+
Wants=aggregation_mode_start.timer
4+
5+
[Service]
6+
Type=oneshot
7+
ExecStart=/home/app/scripts/aggregation_mode_start.sh
8+
EnvironmentFile=/home/app/config/.env.aggregation_mode_start
9+
10+
[Install]
11+
WantedBy=default.target
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
BASE_URL=https://dashboard.tensordock.com/api/v2
4+
5+
echo "Starting GPU Server..."
6+
7+
curl -X GET "$BASE_URL/api/v2/instances" \
8+
-H "Authorization: Bearer $API_KEY" \
9+
-H "Content-Type: application/json" \
10+
-H "Accept: application/json"
11+
12+
echo "GPU Server started successfully."
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=AggregationMode Start Timer
3+
Requires=aggregation_mode_start.service
4+
5+
[Timer]
6+
Unit=aggregation_mode_start.service
7+
AccuracySec=1s
8+
OnBootSec=0
9+
OnUnitActiveSec=2min
10+
11+
[Install]
12+
WantedBy=timers.target
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# This script is for setting up a server that manages the GPU Server startup process.
4+
5+
# Create directories
6+
mkdir -p repos/aggregation_mode
7+
mkdir -p config
8+
mkdir -p .config/systemd/user
9+
10+
# Clone repository
11+
cd $HOME/repos/aggregation_mode
12+
git clone https://github.com/yetanotherco/aligned_layer.git
13+
cd aligned_layer
14+
git checkout staging
15+
cd $HOME/
16+
17+
# Copy systemd service file
18+
cp $HOME/repos/aggregation_mode/aligned_layer/infra/aggregation_mode/aggregation_mode_start.service $HOME/.config/systemd/user/aggregation_mode_start.service
19+
cp $HOME/repos/aggregation_mode/aligned_layer/infra/aggregation_mode/aggregation_mode_start.timer $HOME/.config/systemd/user/aggregation_mode_start.timer
20+
21+
# Copy configuration file
22+
cp $HOME/repos/aggregation_mode/aligned_layer/infra/aggregation_mode/.env.aggregation_mode_start $HOME/config/
23+
24+
# Enable and start the systemd timer
25+
systemctl --user enable aggregation_mode_start.timer
26+
systemctl --user start aggregation_mode_start.timer
27+
28+

0 commit comments

Comments
 (0)