Package: asu
Attendedsysupgrade Server for OpenWrt (GSoC 2017)This project simplifies the sysupgrade process for upgrading the firmware of
devices running OpenWrt or distributions based on it. These tools offer an easy
way to reflash the router with a new firmware version
(including all packages) without the need to useopkg.It's called Attended SysUpgrade (ASU) because the upgrade process is not started
automatically, but is initiated by a user who waits until it's done.ASU is based on an API (described below) to request custom firmware images with
any selection of packages pre-installed. This avoids the need to set up a build
environment, and makes it possible to create a custom firmware image even using
a mobile device.Clients of the Sysupgrade ServerOpenWrt Firmware SelectorSimple web interface using vanilla JavaScript currently developed by @mwarning.
It offers a device search based on model names and show links either toofficial imagesor requests images via theasuAPI. Please join in the development atGitLab repositoryLuCI appThe packageluci-app-attendedsysupgradeoffers a simple tool underSystem > Attended Sysupgrade. It requests a new
firmware image that includes the current set of packages, waits until it's built
and flashes it. If "Keep Configuration" is checked in the GUI, the device
upgrades to the new firmware without any need to re-enter any configuration or
re-install any packages.CLITheaucpackage
performs the same process as theluci-app-attendedsysupgradefrom SSH/the command line.ServerThe server listens for image requests and, if valid, automatically generates
them. It coordinates several OpenWrt ImageBuilders and caches the resulting
images in a Redis database. If an image is cached, the server can provide it
immediately without rebuilding.Active serversysupgrade.openwrt.orgasu.aparcar.orgchef.libremesh.org(CNAMEto
asu.aparcar.org)Run your own serverRedis is required to store image requests:sudo apt install redis-server tarInstallasu:pip install asuCreate aconfig.py.
You can usemisc/config.pyas an example.Start the server via the following commands:export FLASK_APP=asu.asu  # set Flask app to asu
flask janitor update      # download upstream profiles/packages - this runs forever
flask run                 # run development server - this runs foreverStart the worker via the following comand:rq worker                 # this runs foreverDockerRun the service inside multiple Docker containers. The services include the _
ASU_ server itself, ajanitorservice which fills the Redis database with
known packages and profiles as well as arqworkerwhich actually builds
images.Currently all services share the same folder and therefore a very "open" access
is required. Suggestions on how to improve this setup are welcome.mkdir -p ./asu-service/public/
chmod -R 777 ./asu-service/
cp ./misc/config.py ./asu-service/
docker-compose upA webserver should proxy API calls to port 8000 of theserverservice while
theasu/folder should be file hosted as-is.ProductionIt is recommended to runASUviagunicornproxied bynginxorcaddyserver. Find a possible server configurations in themisc/folder.TheASUserver will try$PWD/config.pyand/etc/asu/config.pyto find a
configuration. Find an example configuration in themisc/folder.pip install gunicorn
gunicorn "asu.asu:create_app()"Ideally use the toolsquidto cache package indexes, which are reloaded every
time an image is built. Find a basic configuration in atmisc/squid.confwhich should be copied to/etc/squid/squid.conf.If you want to usesystemdfind the service filesasu.serviceandworker@.servicein themiscfolder as well.DevelopmentAfter cloning this repository, create a Python virtual environment and install
the dependencies:python3 -m venv .direnv
source .direnv/bin/activate
pip install -r requirements.txt
export FLASK_APP=asu.asu  # set Flask app to asu
export FLASK_APP=tests.conftest:mock_app FLASK_DEBUG=1 # run Flask in debug mode with mock data
flask runAPIThe API is documented viaOpenAPIand can be viewed interactively on the
server:https://sysupgrade.openwrt.org/ui/