Change flow of runner setup to be more logical
Some checks failed
Some checks failed
This commit is contained in:
parent
9807c6df9e
commit
2625d34f65
1 changed files with 39 additions and 34 deletions
|
@ -867,6 +867,8 @@ chmod 600 ~/.ssh/config
|
||||||
|
|
||||||
#### 7.1 Download Runner
|
#### 7.1 Download Runner
|
||||||
|
|
||||||
|
**Important**: Run this step as the **DEPLOY_USER** (not root or SERVICE_USER). The DEPLOY_USER handles deployment tasks including downloading and installing the Forgejo runner.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ~
|
cd ~
|
||||||
|
|
||||||
|
@ -900,38 +902,7 @@ sudo mv forgejo-runner-${VERSION#v}-linux-amd64 /usr/bin/forgejo-runner
|
||||||
|
|
||||||
**Production Recommendation**: Use version pinning in production environments to ensure consistency and avoid unexpected breaking changes.
|
**Production Recommendation**: Use version pinning in production environments to ensure consistency and avoid unexpected breaking changes.
|
||||||
|
|
||||||
#### 7.2 Create Systemd Service
|
#### 7.2 Register Runner
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create system config directory for Forgejo runner
|
|
||||||
sudo mkdir -p /etc/forgejo-runner
|
|
||||||
|
|
||||||
sudo tee /etc/systemd/system/forgejo-runner.service > /dev/null << 'EOF'
|
|
||||||
[Unit]
|
|
||||||
Description=Forgejo Actions Runner
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=SERVICE_USER
|
|
||||||
WorkingDirectory=/home/SERVICE_USER
|
|
||||||
ExecStart=/usr/bin/forgejo-runner daemon --config /etc/forgejo-runner/config.yml
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 7.3 Enable Service
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable forgejo-runner.service
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 7.4 Register Runner
|
|
||||||
|
|
||||||
**Important**: The runner must be registered with your Forgejo instance before it can start. This creates the required `.runner` configuration file.
|
**Important**: The runner must be registered with your Forgejo instance before it can start. This creates the required `.runner` configuration file.
|
||||||
|
|
||||||
|
@ -1060,7 +1031,41 @@ sudo chmod 600 /etc/forgejo-runner/config.yml
|
||||||
- Registers the runner with your Forgejo instance
|
- Registers the runner with your Forgejo instance
|
||||||
- Sets up the runner with appropriate labels for Ubuntu and Docker environments
|
- Sets up the runner with appropriate labels for Ubuntu and Docker environments
|
||||||
|
|
||||||
#### 7.5 Start Service
|
**Step 5: Create and Enable Systemd Service**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create system config directory for Forgejo runner
|
||||||
|
sudo mkdir -p /etc/forgejo-runner
|
||||||
|
|
||||||
|
sudo tee /etc/systemd/system/forgejo-runner.service > /dev/null << 'EOF'
|
||||||
|
[Unit]
|
||||||
|
Description=Forgejo Actions Runner
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=SERVICE_USER
|
||||||
|
WorkingDirectory=/home/SERVICE_USER
|
||||||
|
ExecStart=/usr/bin/forgejo-runner daemon --config /etc/forgejo-runner/config.yml
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Enable the service
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable forgejo-runner.service
|
||||||
|
```
|
||||||
|
|
||||||
|
**What this does**:
|
||||||
|
- Creates the systemd service configuration for the Forgejo runner
|
||||||
|
- Points the service to use the configuration file we just set up
|
||||||
|
- Enables the service to start automatically on boot
|
||||||
|
- Sets up proper restart behavior for reliability
|
||||||
|
|
||||||
|
#### 7.3 Start Service
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Start the Forgejo runner service
|
# Start the Forgejo runner service
|
||||||
|
@ -1077,7 +1082,7 @@ sudo systemctl status forgejo-runner.service
|
||||||
- The runner will now be available to accept and execute workflows from your Forgejo instance
|
- The runner will now be available to accept and execute workflows from your Forgejo instance
|
||||||
- The service will automatically restart if it crashes or the system reboots
|
- The service will automatically restart if it crashes or the system reboots
|
||||||
|
|
||||||
#### 7.6 Test Runner Configuration
|
#### 7.4 Test Runner Configuration
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check if the runner is running
|
# Check if the runner is running
|
||||||
|
|
Loading…
Add table
Reference in a new issue