Skip to content

Instantly share code, notes, and snippets.

@svet-b
Created July 30, 2018 21:56
Show Gist options
  • Save svet-b/7d22803917b99a24b8021566920b466a to your computer and use it in GitHub Desktop.
Save svet-b/7d22803917b99a24b8021566920b466a to your computer and use it in GitHub Desktop.
Set up AMMP-edge without snapd
# Ensure that package dependencies are met (specifically python3, libsnmp-dev, and python3-netifaces)
# Create user under which software will be run.
# Enter user directory. In this example this is /opt/datalog
# Pull the codebade
git clone https://github.com/ammpio/ammp-edge.git
# Install python package
cd ammp-edge
./setup.py install --user
# One of the lines should be as follows:
# > Installing ammp_edge script to /opt/datalog/.local/bin
# After that one, dependencies will be installed
# Make some required symlinks to configuration and driver files
cd ..
ln -s ammp-edge/remote.yml
ln -s ammp-edge/drivers/
# Also expose the executable (now in /opt/datalog/bin/ammp_edge)
ln -s .local/bin/
# Create a service that will run the software. Put the following text in a new file
# /etc/systemd/system/ammp-edge.service
### Start
[Unit]
Description=AMMP-edge datalogging service
Documentation=https://www.ammp.io/
After=network-online.target
[Service]
ExecStart=/opt/datalog/bin/ammp_edge -d
Restart=always
WorkingDirectory=/opt/datalog
User=datalog
TimeoutStopSec=30
Type=simple
[Install]
WantedBy=multi-user.target
### End
# (you can remove the -d from ExecStart if you don't want debug info)
# Enable the service with
sudo systemctl enable ammp-edge.service
# Start with
sudo systemctl start ammp-edge.service
# Check logs
sudo journalctl -u ammp-edge.service -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment