-
Notifications
You must be signed in to change notification settings - Fork 3
Host: MacOS
Aquarium Fish node could be running on MacOS.
Of course you can just download the aquarium-fish binary and run it as is, but if you want to deploy it as an autostart service and less privileged user, it's worth to follow those steps. Not all the commands are necessary and here mostly to show the general path of how to make it right.
The commands are executed through SSH as root on MacOS 11 x64. Make sure you know what you doing for each step and adjust for your system.
-
Create non privileged user for fish node:
dscl . -create /Groups/_aquarium-fish dscl . -create /Groups/_aquarium-fish PrimaryGroupID 300 dscl . -create /Users/_aquarium-fish UniqueID 300 dscl . -create /Users/_aquarium-fish PrimaryGroupID 300 dscl . -create /Users/_aquarium-fish UserShell /bin/sh dscl . -create /Users/_aquarium-fish NFSHomeDirectory /Users/aquarium-fish mkdir /Users/aquarium-fish chown _aquarium-fish:_aquarium-fish /Users/aquarium-fish
-
(optional) Install VMware Fusion to use it as resource provider:
mkdir /tmp/vmwarefusion hdiutil attach VMware-Fusion-13.0.1-21139760_universal.dmg -nobrowse -mountpoint /tmp/vmwarefusion cp -a '/tmp/vmwarefusion/VMware Fusion.app/Contents/Library/Deploy VMware Fusion.mpkg' /tmp/ cp -a '/tmp/vmwarefusion/VMware Fusion.app' '/tmp/Deploy VMware Fusion.mpkg/Contents/00Fusion_Deployment_Items/' hdiutil detach /tmp/vmwarefusion sed -i.bak -e 's/^# key =.*/key = <YOUR_LICENSE_KEY>/' '/tmp/Deploy VMware Fusion.mpkg/Contents/00Fusion_Deployment_Items/Deploy.ini' installer -pkg '/tmp/Deploy VMWare Fusion.mpkg' -target / reboot
-
Create main service folder for fish node:
mkdir -p /opt/aquarium-fish/ws chown _aquarium-fish:_aquarium-fish /opt/aquarium-fish/ws
-
Unpack aquarium-fish binary to the right place:
tar -C /opt/aquarium-fish --no-same-owner -xf aquarium-fish-v*.darwin_amd64.tar.xz
-
Create config file to define the node:
--- node_name: test-node-mac.corp.example.com node_location: us-west-2a default_resource_lifetime: 1h30m # Recommended to specify how much resources the Fish node could consume cpu_limit: 2 # For local resource management 1-2 is ok, for server-only could be skipped to consume as much as possible mem_target: '512MB' # To tell GC where to become really aggressive, otherwise could cause OOM if to close to system limit # In case you configure the drivers - only the defined drivers will be activated drivers: # Configure vmx here for example - name: vmx cfg: download_user: user download_password: password
vim /opt/aquarium-fish/config.yml chown root:_aquarium-fish /opt/aquarium-fish/config.yml chmod 640 /opt/aquarium-fish/config.yml
-
Run aquarium-fish first time to get admin creds, then press Ctrl-C to stop it: WARNING: This command will create SSL CA which will last for 1 year. Please check openssl docs to generate better CA and certificates for nodes in your cluster.
su _aquarium-fish -c "sh -c 'cd /opt/aquarium-fish/ws && ../aquarium-fish -c ../config.yml'"
-
Copy the unit service file to the systemd configs and touch the log file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>aquarium-fish</string> <key>UserName</key> <string>_aquarium-fish</string> <key>GroupName</key> <string>_aquarium-fish</string> <key>ProgramArguments</key> <array> <string>/opt/aquarium-fish/aquarium-fish</string> <string>-c</string> <string>/opt/aquarium-fish/config.yml</string> </array> <key>WorkingDirectory</key> <string>/opt/aquarium-fish/ws</string> <key>SessionCreate</key> <true/> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>SoftResourceLimits</key> <dict> <!-- Helps with images unpacking and running workload --> <key>NumberOfFiles</key> <integer>65536</integer> </dict> <key>HardResourceLimits</key> <dict> <!-- Helps with images unpacking and running workload --> <key>NumberOfFiles</key> <integer>131072</integer> </dict> <key>StandardOutPath</key> <string>/opt/aquarium-fish/fish.log</string> <key>StandardErrorPath</key> <string>/opt/aquarium-fish/fish.log</string> </dict> </plist>
vim /Library/LaunchDaemons/aquarium-fish.plist touch /opt/aquarium-fish/fish.log chown root:_aquarium-fish /opt/aquarium-fish/fish.log chmod 660 /opt/aquarium-fish/fish.log
-
Start the service and enable for autostart:
launchctl bootstrap system /Library/LaunchDaemons/aquarium-fish.plist launchctl enable system/aquarium-fish
-
(optional) Check the service is running ok:
tail -f /opt/aquarium-fish/fish.log