Skip to content

Commit cf45c18

Browse files
committed
fix last details
1 parent 2e00a49 commit cf45c18

35 files changed

+846
-341
lines changed

.github/workflows/docker-workflow.yml

Lines changed: 173 additions & 123 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,7 @@ ips_blocked.json
171171

172172
firewall-events.json
173173
.DS_Store
174-
DS_Store
174+
DS_Store
175+
176+
.build
177+
.secrets

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
# **SubVortex Auto Upgrader** <!-- omit in toc -->
44

5+
[![Build & Push](https://github.com/eclipsevortex/SubVortex.AutoUpgrader/actions/workflows/docker-workflow.yml/badge.svg?branch=main)](https://github.com/eclipsevortex/SubVortex.AutoUpgrader/actions/workflows/docker-workflow.yml)
56
[![Discord Chat](https://img.shields.io/discord/308323056592486420.svg)](https://discord.gg/bittensor)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
78

89
---
910

1011
## Effortless Updates for Your Miner & Validator <!-- omit in toc -->
1112

12-
[Discord](https://discord.gg/bittensor)[Network](https://taostats.io/)[Research](https://bittensor.com/whitepaper)
13+
[Github]() [Discord](https://discord.gg/bittensor)[Network](https://taostats.io/)[Research](https://bittensor.com/whitepaper)
1314

1415
---
1516

@@ -27,6 +28,7 @@
2728
- [Prerequisites](#prerequisites)
2829
- [How It Works](#how-it-works)
2930
- [Quick Start](#quick-start)
31+
- [Quick Stop](#quick-stop)
3032
- [Installation](#installation)
3133
- [Run as Process](#run-as-process)
3234
- [Run as Service](#run-as-service)
@@ -53,6 +55,11 @@ Simple to set up. Easy to monitor. Zero stress upgrades.
5355

5456
# ⚙️ Prerequisites <a id="prerequisites"></a>
5557

58+
> ⚠️ **Architecture Notice**
59+
> The SubVortex Auto Upgrader currently supports only **x86_64 (amd64)** servers.
60+
> `arm64` support is not yet available but is a work in progress.
61+
> We’re actively collaborating with OTF to bring full compatibility as soon as possible.
62+
5663
Before you begin, make sure you clone the Auto Upgrader repository:
5764

5865
```bash
@@ -61,7 +68,7 @@ git clone https://github.com/eclipsevortex/SubVortex.AutoUpgrader.git
6168

6269
Then, configure your environment:
6370

64-
1. Update the environment variables inside the `environment/` folder.
71+
1. Update the environment variables inside the `subvortex/auto_upgrader/environment/` folder.
6572

6673
- For miners, edit files matching `env.subvortex.miner.*`
6774
- For validators, edit files matching `env.subvortex.validator.*`
@@ -100,14 +107,16 @@ When setting up the Auto Upgrader, you can choose from three execution modes: `p
100107
🧩 Process & Service Modes
101108

102109
In these modes, the Auto Upgrader checks GitHub every **SUBVORTEX_CHECK_INTERVAL** seconds for new releases. When a new version is available, it:
110+
103111
1. Downloads and unzips the archive for your neuron type (**SUBVORTEX_EXECUTION_ROLE**) into **SUBVORTEX_WORKING_DIRECTORY**
104-
2. Installs the new version
112+
2. Install the new version
105113
3. Updates the symlink to point to the new version
106114
4. Cleans up the previous version
107115

108116
🐳 Docker Mode
109117

110118
Here, the Auto Upgrader also checks GitHub every **SUBVORTEX_CHECK_INTERVAL** seconds. When a new release is found:
119+
111120
1. It pulls the floating tag that matches your desired release type (**SUBVORTEX_PRERELEASE_TYPE**)
112121
2. It starts the updated container
113122

@@ -123,7 +132,19 @@ To install the Auto Upgrader in a quick way, you can run
123132
./scripts/quick_start.sh
124133
```
125134

126-
It will install the Auto Upgrade as service which is the default mode.
135+
It will install and start the Auto Upgrader as service which is the default mode.
136+
137+
Use `-h` to see the options
138+
139+
# 🛑 Quick Stop <a id="quick-stop"></a>
140+
141+
To stop the Auto Upgrader in a quick way, you can run
142+
143+
```bash
144+
./scripts/quick_stop.sh
145+
```
146+
147+
It will stop and teardown the Auto Upgrader.
127148

128149
Use `-h` to see the options
129150

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1
1+
0.0.1-alpha.1

docker-compose.local.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
auto_upgrader:
3+
build:
4+
context: ../../
5+
dockerfile: ./subvortex/auto_upgrader/Dockerfile
6+
additional_contexts:
7+
wheelbuilder: docker-image://subvortex/subvortex-wheel-builder:latest
8+
container_name: subvortex-auto-upgrader
9+
restart: unless-stopped
10+
env_file:
11+
- ./subvortex/auto_upgrader/.env
12+
volumes:
13+
- /var/log:/app/logs
14+
labels:
15+
- "com.centurylinklabs.watchtower.enable=true"
16+
17+
watchtower:
18+
image: containrrr/watchtower
19+
container_name: subvortex-watchtower
20+
volumes:
21+
- /var/run/docker.sock:/var/run/docker.sock
22+
command: --interval ${SUBVORTEX_CHECK_INTERVAL} --cleanup --label-enable
23+
restart: unless-stopped
24+
environment:
25+
- WATCHTOWER_CLEANUP=true
26+
- WATCHTOWER_LABEL_ENABLE=true
27+
- WATCHTOWER_INCLUDE_RESTARTING=true

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212

1313
watchtower:
1414
image: containrrr/watchtower
15-
container_name: subvortex-auto-upgrader
15+
container_name: subvortex-watchtower
1616
volumes:
1717
- /var/run/docker.sock:/var/run/docker.sock
1818
command: --interval ${SUBVORTEX_CHECK_INTERVAL} --cleanup --label-enable

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ include = ["subvortex", "subvortex.auto_upgrader"]
4848
"**/requirements.txt",
4949
"**/README.md",
5050
"**/env.template",
51+
"**/docker-compose.yml",
5152
]
5253

5354
[tool.setuptools.exclude-package-data]
5455
"subvortex" = ["**/venv/*", "**/.venv/*"]
55-
"subvortex.auto_upgrader" = ["**/venv/*", "**/.venv/*"]
56+
"subvortex.auto_upgrader" = ["**/venv/*", "**/.venv/*"]

scripts/auto_upgrader/auto_upgrade_setup.sh renamed to scripts/auto_upgrader/auto_upgrader_setup.sh

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
set -e
44

5-
ENV_FILE="subvortex/auto_upgrader/.env"
6-
7-
# Load .env
8-
if [ ! -f "$ENV_FILE" ]; then
9-
echo "❌ .env file not found!"
10-
exit 1
11-
fi
12-
13-
export $(grep -v '^#' "$ENV_FILE" | xargs)
14-
155
# Help function
166
show_help() {
177
echo "Usage: $0 [--execution=process|container|service]"
@@ -41,7 +31,7 @@ while [ "$#" -gt 0 ]; do
4131
-e |--execution)
4232
METHOD="$2"
4333
shift 2
44-
;;
34+
;;
4535
-h | --help)
4636
show_help
4737
exit 0
@@ -53,21 +43,15 @@ while [ "$#" -gt 0 ]; do
5343
esac
5444
done
5545

56-
if [[ "$METHOD" == "container" || "${SUBVORTEX_EXECUTION_METHOD,,}" == "container" ]]; then
46+
# Load environment variables
47+
export $(grep -v '^#' ./subvortex/auto_upgrader/.env | xargs)
48+
49+
# Install if needed docker if the auto uprader is managing the upgrade of containers
50+
if [[ "$SUBVORTEX_EXECUTION_METHOD" == "container" ]]; then
5751
# Check if docker is installed
5852
if ! command -v docker &> /dev/null; then
5953
echo "❌ Docker is not installed. Installing it now."
60-
./../docker/docker_setup.sh
61-
fi
62-
63-
# Check which compose command is available
64-
if docker compose version &> /dev/null; then
65-
DOCKER_CMD="docker compose"
66-
elif command -v docker-compose &> /dev/null; then
67-
DOCKER_CMD="docker-compose"
68-
else
69-
echo "❌ Neither 'docker compose' nor 'docker-compose' is installed. Please install Docker Compose."
70-
exit 1
54+
./scripts/docker/docker_setup.sh
7155
fi
7256
fi
7357

@@ -89,8 +73,8 @@ setup_process() {
8973
setup_container() {
9074
echo "🐳 Setting up for 'container' mode..."
9175

92-
# Install docker
93-
./scripts/docker/docker_setup.sh
76+
# Setup the auto upgrade as container
77+
./subvortex/auto_upgrader/deployment/container/auto_upgrader_container_setup.sh
9478

9579
# Add any other container-specific logic here
9680
echo "✅ Container setup complete."
@@ -121,7 +105,7 @@ run_setup() {
121105
setup_service
122106
;;
123107
*)
124-
echo "❌ Unknown SUBVORTEX_EXECUTION_METHOD: '$METHOD'"
108+
echo "❌ Unknown METHOD: '$METHOD'"
125109
exit 1
126110
;;
127111
esac

scripts/auto_upgrader/auto_upgrade_start.sh renamed to scripts/auto_upgrader/auto_upgrader_start.sh

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
set -e
44

5-
ENV_FILE=".env"
6-
7-
# Load .env
8-
if [ ! -f "$ENV_FILE" ]; then
9-
echo "❌ .env file not found!"
10-
exit 1
11-
fi
12-
13-
export $(grep -v '^#' "$ENV_FILE" | xargs)
14-
155
# Help function
166
show_help() {
177
echo "Usage: $0 [--execution=process|container|service]"
@@ -75,9 +65,6 @@ done
7565
setup_process() {
7666
echo "⚙️ Setting up for 'process' mode..."
7767

78-
# Install pm2
79-
./scripts/install_pm2.sh
80-
8168
# Start the auto upgrade as process
8269
./subvortex/auto_upgrader/deployment/proecss/auto_upgrader_process_start.sh
8370

@@ -89,9 +76,6 @@ setup_process() {
8976
setup_container() {
9077
echo "🐳 Setting up for 'container' mode..."
9178

92-
# Install docker
93-
./scripts/docker/docker_setup.sh
94-
9579
# Start the auto upgrade as service
9680
./subvortex/auto_upgrader/deployment/container/auto_upgrader_container_start.sh
9781

@@ -112,9 +96,7 @@ setup_service() {
11296

11397
# 🚀 Function: Dispatch based on method
11498
run_setup() {
115-
# Install watchtower if the SUBVORTEX_EXECUTION_ROLE is container
116-
if [[ "$METHOD" == "container" || "${SUBVORTEX_EXECUTION_METHOD,,}" == "container" ]]; then
117-
echo $(pwd)
99+
if [[ "$SUBVORTEX_EXECUTION_METHOD" == "container" ]]; then
118100
./scripts/watchtower/watchtower_start.sh
119101
fi
120102

scripts/auto_upgrader/auto_upgrade_stop.sh renamed to scripts/auto_upgrader/auto_upgrader_stop.sh

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
set -e
44

5-
ENV_FILE=".env"
6-
7-
# Load .env
8-
if [ ! -f "$ENV_FILE" ]; then
9-
echo "❌ .env file not found!"
10-
exit 1
11-
fi
12-
13-
export $(grep -v '^#' "$ENV_FILE" | xargs)
14-
155
# Help function
166
show_help() {
177
echo "Usage: $0 [--execution=process|container|service]"
@@ -57,9 +47,6 @@ done
5747
setup_process() {
5848
echo "⚙️ Setting up for 'process' mode..."
5949

60-
# Install pm2
61-
./scripts/install_pm2.sh
62-
6350
# Stop the auto upgrade as process
6451
./subvortex/auto_upgrader/deployment/proecss/auto_upgrader_process_stop.sh
6552

@@ -71,9 +58,6 @@ setup_process() {
7158
setup_container() {
7259
echo "🐳 Setting up for 'container' mode..."
7360

74-
# Install docker
75-
./scripts/docker/docker_setup.sh
76-
7761
# Stop the auto upgrade as service
7862
./subvortex/auto_upgrader/deployment/container/auto_upgrader_container_stop.sh
7963

@@ -110,9 +94,7 @@ run_setup() {
11094
;;
11195
esac
11296

113-
# Install watchtower if the SUBVORTEX_EXECUTION_ROLE is container
114-
if [[ "$METHOD" == "container" || "${SUBVORTEX_EXECUTION_METHOD,,}" == "container" ]]; then
115-
echo $(pwd)
97+
if [[ "$SUBVORTEX_EXECUTION_METHOD" == "container" ]]; then
11698
./scripts/watchtower/watchtower_stop.sh
11799
fi
118100
}

0 commit comments

Comments
 (0)