Skip to content
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
35788c9
Add go.mof and main file
ppawlowski Apr 27, 2025
0b3a0e7
Add `cmd` package with install instructions
ppawlowski Apr 27, 2025
cd307bd
Add `config` package
ppawlowski Apr 27, 2025
88a27e9
Add `logger` package
ppawlowski Apr 27, 2025
2c0a52c
Add `nodejs` package
ppawlowski Apr 27, 2025
92cd543
Add `service` package
ppawlowski Apr 27, 2025
c23e21c
Add `utils` package
ppawlowski Apr 27, 2025
5e1d160
Add build shell script
ppawlowski Apr 27, 2025
7c950b5
Add GetOSDetails function
ppawlowski Apr 30, 2025
5a5395b
Handle properly node js archive for ARM
ppawlowski Apr 30, 2025
42f4277
Add debug information about os and architecture
ppawlowski Apr 30, 2025
163e275
Add helm flag
ppawlowski Apr 30, 2025
b6ff1ad
Add initial installer readme
ppawlowski Apr 30, 2025
c0dac59
Check if sudo command is available
ppawlowski May 1, 2025
9650add
Add sysvinit support
ppawlowski May 1, 2025
c0df83f
Replace flag with pflag
ppawlowski May 5, 2025
05889fa
Adjust PATH in linux services templates
ppawlowski May 5, 2025
2ce9a8b
Replace node with generic linux tools in build script
ppawlowski May 5, 2025
55f6689
Sync with the latest changes from the main branch
ppawlowski May 6, 2025
4ffeb72
Add tip about exec permissions; fix typos
ppawlowski May 7, 2025
f6ca052
Bump nodejs to v20.19.1
ppawlowski May 7, 2025
6e5be33
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski May 7, 2025
bff4a96
Update main install file
ppawlowski May 8, 2025
3c05a91
Update deviceagent installation on windows
ppawlowski May 8, 2025
eb80c09
Adjust utils to run on windows, remove unused functions
ppawlowski May 8, 2025
9216f93
Add support for windows to service package
ppawlowski May 8, 2025
b698090
Add macos support for multiple utils functions
ppawlowski May 12, 2025
ddea292
Add support for macos to nodejs package
ppawlowski May 12, 2025
0045fbf
Add support for macos to service package
ppawlowski May 12, 2025
1a121b0
Update manula build script
ppawlowski May 12, 2025
b29d8be
Update installer/go/README.md
ppawlowski May 12, 2025
93b43b2
Update installer/go/README.md
ppawlowski May 12, 2025
db7814f
Update installer/go/README.md
ppawlowski May 12, 2025
70e3d73
Update installer/go/README.md
ppawlowski May 12, 2025
061b80e
Add `--otc-no-start` flag to device-agent configure command
ppawlowski May 12, 2025
5e68f0f
Merge branch 'main' of github.com:FlowFuse/device-agent into feat-dev…
ppawlowski May 12, 2025
1db68df
Run device-agent to allow flows import
ppawlowski May 15, 2025
bbfdc65
Verify if workdir and device config file exists
ppawlowski May 15, 2025
a0c6fb9
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski May 15, 2025
eaff83e
Improve user creation debug messages on windows
ppawlowski May 15, 2025
7b1e5a1
Add logs rotation; optimise nssm commands
ppawlowski May 15, 2025
f8fa034
Add workdir to service description
ppawlowski May 15, 2025
172006b
Add pre-check to Uninstall function
ppawlowski May 16, 2025
a6c1f59
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski May 16, 2025
5c07a02
Remove setEnvPath function
ppawlowski May 22, 2025
6abe5e9
Add SetEnvPath and checkEnvPath functions
ppawlowski May 22, 2025
41efa49
Fix PATH value
ppawlowski May 22, 2025
88d6205
Fix PATH, remove unused function
ppawlowski May 22, 2025
0c63747
Add `YesNoPrompt` function
ppawlowski May 26, 2025
dfe75fd
Add `validate` package
ppawlowski May 26, 2025
2618246
Run pre-install validation
ppawlowski May 26, 2025
a8920b1
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski May 26, 2025
b3c0f7c
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski May 26, 2025
8cd206b
Enable custom npm cache dir for linux and darwin
ppawlowski May 27, 2025
b83039a
Ensure proper service file path; fix log dir creation; fix service fi…
ppawlowski May 27, 2025
aee6e50
Remove user homedir on macos; create proper chown command in ExtractT…
ppawlowski May 27, 2025
5e080ee
Add logs rotation for darwin
ppawlowski Jun 1, 2025
e703ea7
Remove workdir content istead of workdir itself
ppawlowski Jun 1, 2025
b0b51ec
Replace build.sh with makefile
ppawlowski Jun 1, 2025
dade8ef
Replace build.sh with makefile
ppawlowski Jun 1, 2025
385c370
Uninstall service on PreInstall
ppawlowski Jun 1, 2025
fc3e94a
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 1, 2025
be0d833
Add windows build to makefile
ppawlowski Jun 1, 2025
cb0fe64
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 1, 2025
348bf34
Add darwin build to makefile
ppawlowski Jun 1, 2025
8cc96df
Update gitignore
ppawlowski Jun 2, 2025
6d8e7a9
Update macos build dir
ppawlowski Jun 2, 2025
f1c270e
Add phony targets to makefile
ppawlowski Jun 4, 2025
907e74a
Adjust the order of preinstall check
ppawlowski Jun 4, 2025
3d90268
Adjust error message in `checkWindowsPermissions`
ppawlowski Jun 4, 2025
51033ae
Handle path to `device.yml` properly in `checkConfigFileExists`
ppawlowski Jun 4, 2025
799a92c
Fix fullPath value in `RemoveWorkingDirectory` function
ppawlowski Jun 4, 2025
5cb0e77
Adjust workdir content removal approach for windows in `RemoveWorking…
ppawlowski Jun 4, 2025
0bbb7f0
Simplify windows service removal
ppawlowski Jun 4, 2025
66495ff
Fix typo in build target
ppawlowski Jun 4, 2025
d3c283d
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 4, 2025
44cfbbe
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 4, 2025
983ab2a
Simplify binary path declaration in `InstallWindows` function
ppawlowski Jun 4, 2025
cd9b58a
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 4, 2025
a445349
Add support for alpine/openrc linux systems
ppawlowski Jun 5, 2025
9b69489
Run config as root to access regular users flows
ppawlowski Jun 5, 2025
bae1fd2
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 5, 2025
20a1bb8
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 5, 2025
0957a37
Run checkLibstdcExists on linux only
ppawlowski Jun 6, 2025
41737fc
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 6, 2025
678a0c1
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 6, 2025
dccd7eb
Fix permissions set after device configuration
ppawlowski Jun 6, 2025
6d6b541
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 6, 2025
9de9084
Improve makefile
ppawlowski Jun 6, 2025
0cdb412
Improve installer readme
ppawlowski Jun 6, 2025
89c21ca
Add macos management commands
ppawlowski Jun 6, 2025
21de8e9
Fix winget link
ppawlowski Jun 6, 2025
eb75033
Simplify build info in readme
ppawlowski Jun 6, 2025
4aebc61
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 6, 2025
83a8be6
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 6, 2025
9415eaa
Add git clone command to the readme
ppawlowski Jun 6, 2025
98ca302
Merge branch 'feat-device-linux-installer' of github.com:FlowFuse/dev…
ppawlowski Jun 6, 2025
b685f51
Merge branch 'feat-device-win-installer' of github.com:FlowFuse/devic…
ppawlowski Jun 6, 2025
7718798
Extend installation summary
ppawlowski Jun 17, 2025
fd710cc
Merge branch 'main' of github.com:FlowFuse/device-agent into feat-dev…
ppawlowski Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/
var/
/installer/go/out/
201 changes: 201 additions & 0 deletions installer/go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# FlowFuse Device Agent Installer

A Go-based installer for the FlowFuse Device Agent that automatically sets up Node.js, installs the device agent package, and configures it as a system service.

## Getting Started

### Requirements

- Linux, macOS, or Windows
- Internet connection for downloading dependencies
- Administrator/root privileges for system service installation

### Installation

Download the installer binary for your platform and run:

```bash
# Make the binary executable (Linux/macOS)
chmod +x flowfuse-device-agent-installer

# Install with one-time code from FlowFuse
./flowfuse-device-agent-installer --otc YOUR_ONE_TIME_CODE
```

### Available Options

| Flag | Short | Default | Description |
|------|--------|---------|-------------|
| `--otc` | `-o` | *required* | FlowFuse one-time code for authentication |
| `--url` | `-u` | `https://app.flowfuse.com` | FlowFuse instance URL |
| `--node` | `-n` | `20.19.1` | Node.js version to install |
| `--agent` | `-a` | `latest` | Device agent version to install |
| `--service-user` | `-s` | `flowfuse` | Username for the service account (linux/macos)|
| `--debug` | | `false` | Enable debug logging |
| `--help` | `-h` | | Display help information |

### Management Commands

```bash
# Minimal usage
./flowfuse-device-agent-installer --otc ONE_TIME_CODE

# Install with custom settings
./flowfuse-device-agent-installer --otc ONE_TIME_CODE --url https://your-flowfuse-instance.com --node 18.20.0

# Enable debug logging
./flowfuse-device-agent-installer --otc ONE_TIME_CODE --debug

# Uninstall the device agent
./flowfuse-device-agent-installer --uninstall

# See help for all options
./flowfuse-device-agent-installer --help
```


### Troubleshooting

### Managing FlowFuse Device Agent service

#### Linux (systemd)

```bash
# Start the service
sudo systemctl start flowfuse-device-agent
# Stop the service
sudo systemctl stop flowfuse-device-agent
# Restart the service
sudo systemctl restart flowfuse-device-agent
# Check service status
sudo systemctl status flowfuse-device-agent
```

#### Linux (SysVinit)

```bash
# Start the service
sudo service flowfuse-device-agent start
# Stop the service
sudo service flowfuse-device-agent stop
# Restart the service
sudo service flowfuse-device-agent restart
# Check service status
sudo service flowfuse-device-agent status
```

#### Linux (OpenRC)

```bash
# Start the service
sudo rc-service flowfuse-device-agent start
# Stop the service
sudo rc-service flowfuse-device-agent stop
# Restart the service
sudo rc-service flowfuse-device-agent restart
# Check service status
sudo rc-service flowfuse-device-agent status
```

#### macOS (launchd)

```bash
# Start the service
sudo launchctl start com.flowfuse.device-agent
# Stop the service
sudo launchctl stop com.flowfuse.device-agent
# Restart the service
sudo launchctl kickstart -k system/com.flowfuse.device-agent
# Check service status
sudo launchctl print system/com.flowfuse.device-agent
```

#### Windows (Service Control)

```
# Start the service
sc.exe start flowfuse-device-agent
# Stop the service
sc.exe stop flowfuse-device-agent
# Restart the service
sc.exe restart flowfuse-device-agent
# Check service status
sc.exe query flowfuse-device-agent
```


### Log Files
- **Linux/macOS**: `/opt/flowfuse-device/logs/flowfuse-device-agent.log`
- **Linux(systemd)**: `journalctl -u flowfuse-device-agent`
- **Windows**: `C:\opt\flowfuse-device\logs\flowfuse-device-agent.log`

## Development

### Prerequisites

- Go 1.21 or later ([Install Go](https://go.dev/doc/install))
- Make (optional, for using Makefile commands)

Windows users can install `make` and `sed` (used in Makefile) via [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget):
```
winget install --id=GnuWin32.Make -e
winget install --id=mbuilov.sed -e
```

### Development Setup

```bash
# Clone this repo and navigate to the installer directory
git clone [email protected]:FlowFuse/device-agent.git
cd installer/go

# Install dependencies
go mod download

# Run locally
go run main.go --help
```

### Building

```bash
# Build for all platforms
make build
```

Binaries will be created in the `out/` directory for Linux, macOS, and Windows.

### Code Quality

```bash
# Run all quality checks
make check-quality

# Individual commands
make lint # Run linter
make fmt # Format code
make vet # Run go vet
```

### Project Structure

```
├── main.go # Application entry point
├── cmd/
│ └── install.go # Installation commands
└── pkg/
├── config/ # Configuration file handling
├── logger/ # Logging functions
├── nodejs/ # Node.js related functions
├── service/ # System service functions
├── utils/ # Miscellaneous functions
└── validate/ # Environment validation functions
```

### Cleaning Up

To clean up build artifacts and temporary files, run:

```bash
make clean
```
Loading