[LineageOS][OTA][PHP] Open Source REST Server for you

Is this project useful?


  • Total voters
    93
Search This thread

JulianXhokaxhiu

Senior Member
Aug 14, 2012
535
760
133
julianxhokaxhiu.com
  • Like
Reactions: Deltadroid

sjrmac

Senior Member
Nov 16, 2016
373
338
73
New version 2.1.1 released!

Changelog:
- Extend the legacy updater channel support to any Lineage ROM < 14.1

Now you can build any Lineage < 14.1 version ( eg. 13.0 or 14.0 ) and have full support of the updater logic also on them.
Hey Julian, I followed your instructions to get this going and I installed in /var/www/ but I don't have html, do I need that and would you mind checking my page? I really want to get my server running but I have almost no experience with php or Apache... I do have them installed though, I might need to reinstall Apache to get the html folder back...
http://otasjrmac.ddns.net/LineageOTA/
Or just http://otasjrmac.ddns.Net
Thanks!
Sam
 

JulianXhokaxhiu

Senior Member
Aug 14, 2012
535
760
133
julianxhokaxhiu.com
Hey Julian it is me again, when I go to my page, I have this issue where it displays everything in index.php. Apache has the rules configured right and everything, but not sure why this is happening.. anyone want to give me a hand with this?
http://otasjrmac.ddns.net/LineageOTA

Hi there, looks good to me. Did you try the unit test?

Wich is the last version recommended to use with cyanogenmod13?

Latest. It's retro compatible.
 

sjrmac

Senior Member
Nov 16, 2016
373
338
73
Hey Julian, could you tell me what's wrong with otasjrmac.ddns.net ? The api in the rest unit is something I can't get the console.log from. I also wanted to make folders in the builds folder for specific devices so there is not a massive clutter. It that supported?

Ex: builds/full/j7ltespr (has zip file inside) instead of builds/full/ (all zips, a mess possibly) changelogs location? They need a separate folder?

Thanks
Sam
 

gabrielgagz

Senior Member
Jul 10, 2011
265
61
0
Hi guys i read and search all thread and i can't find an answer. Someone of you are using some free or paid web hosting?
I try i few but none seems to work....
 

agentjrt

Member
Feb 9, 2014
26
23
33
Berlin
jrtberlin.de
EDIT: Works now, without any change.

I'm getting this error. Any idea how to fix this?
Code:
500 Internal Server Error

Undefined offset: 0 (8)
#0 /var/www/html/LineageOTA/src/Helpers/Build.php(213): flight\Engine->handleError(8, 'Undefined offse...', '/var/www/html/L...', 213, Array)
#1 /var/www/html/LineageOTA/src/Helpers/Build.php(63): JX\CmOta\Helpers\Build->removeTrailingDashes(Array)
#2 /var/www/html/LineageOTA/src/Helpers/Builds.php(150): JX\CmOta\Helpers\Build->__construct('lineage-14.1-20...', '/var/www/html/L...')
#3 /var/www/html/LineageOTA/src/Helpers/Builds.php(49): JX\CmOta\Helpers\Builds->getBuilds()
#4 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Loader.php(123): JX\CmOta\Helpers\Builds->__construct()
#5 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Loader.php(80): flight\core\Loader->newInstance('\\JX\\CmOta\\Helpe...', Array)
#6 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/Engine.php(74): flight\core\Loader->load('builds', true)
#7 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(196): flight\Engine->__call('builds', Array)
#8 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod(Array, Array)
#9 /var/www/html/LineageOTA/src/CmOta.php(86): Flight::__callStatic('builds', Array)
#10 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(165): JX\CmOta\CmOta->JX\CmOta\{closure}()
#11 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(143): flight\core\Dispatcher::callFunction(Object(Closure), Array)
#12 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/Engine.php(322): flight\core\Dispatcher::execute(Object(Closure), Array)
#13 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(196): flight\Engine->_start()
#14 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(142): flight\core\Dispatcher::invokeMethod(Array, Array)
#15 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(48): flight\core\Dispatcher::execute(Array, Array)
#16 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/Engine.php(65): flight\core\Dispatcher->run('start', Array)
#17 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/core/Dispatcher.php(196): flight\Engine->__call('start', Array)
#18 /var/www/html/LineageOTA/vendor/mikecao/flight/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod(Array, Array)
#19 /var/www/html/LineageOTA/src/CmOta.php(69): Flight::__callStatic('start', Array)
#20 /var/www/html/LineageOTA/index.php(37): JX\CmOta\CmOta->run()
#21 {main}
 
Last edited:

sjrmac

Senior Member
Nov 16, 2016
373
338
73
Cm.updater.uri is not going to work anymore as LineageOS has their own updater now. Just letting you all know that it probably needs to be changed
 

TimSchumi

Senior Member
Mar 9, 2016
869
395
93
19
Last edited:

JulianXhokaxhiu

Senior Member
Aug 14, 2012
535
760
133
julianxhokaxhiu.com
I didn't (or at least I didn't want to) say you were wrong, I just wanted to note that there is a new Updater package.

Also, LineageOS will now move to a new prop as it seems: https://review.lineageos.org/#/c/191274

Thank you :) No issues, I never took this personal and I you did neither. Although this MR is really helpful, and I'll check if I have to do something on my side, or just update documentation. As this key is added and used by ROM Developers actually. In the OTA there is no usage of it.

Anyway, a checkup will not hurt. But if you see points to patch, feel free to come up with a PR on the repo.
 

Charles IV

Senior Member
Jan 15, 2016
566
179
73
I have been testing the new LineageOS Updater and I wanted to share some of my notes:

1) This commit is unmerged still, but is required: https://review.lineageos.org/#/c/154721/ (without it, updater will not be visible in the app drawer)
2) mongodb, flask, and python-pip are required ubuntu packages. The other dependencies are installed via "pip". See requirements text in LineageOS OTA README.
3) A web server needs to host the builds (ie; Apache2) along with the python server (hosting the database) running on port 5000. Apache2 needs to setup a proxy to the python server.

Code:
ProxyRequests Off
ProxyPreserveHost On

ProxyPass /LineageOS/ http://127.0.0.1:5000/
ProxyPassReverse /LineageOS/ http://127.0.0.1:5000/

4) Apache2 needs proxy and proxy_http enabled.
5) app.cfg (from lineage_updater) needs to look like this if running on the same server as Apache. (user/pass blank)

Code:
MONGODB_DB = 'lineageos_updater'
MONGODB_USERNAME = ''
MONGODB_PASSWORD = ''
MONGODB_HOST = '127.0.0.1'
MONGODB_PORT = 27017

6) If a LineageOS subdir (http://localhost/LineageOS) is used in the Apache document root, the following patch is required:
https://github.com/syphyr/lineageos_updater/commit/030deabe2a289bba2a029bed6d23dc34111e64b0

7) This commit is needed to enable removing entries from the mongo db:
https://github.com/syphyr/lineageos_updater/commit/962648c227448b47bde5cf568ff9f37f2853c64c

8) Here are some example scripts for adding/removing mongo db entries:
https://github.com/syphyr/cm_build_scripts/blob/master/bin/ota_add
https://github.com/syphyr/cm_build_scripts/blob/master/bin/ota_remove

9) This is what the Lineage updater uri looks like in build.prop (if a LineageOS subdir is used on Apache):
https://github.com/syphyr/android_d...mmit/412f6347bc0458de0b6243921d772e10795a0ae3

I am having trouble connecting the proxy.

I originally wasn't going to, but while 127.0.0.1:5000 would work, 192.168.1.119:5000 wouldn't, even from my computer.

I added the first bit of code to /etc/apache2/sites-enabled/000-default.conf, so it now looks like this:
Code:
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin [email protected]
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf

</VirtualHost>

# by me - los stuff
<VirtualHost *:*>
	
	# Lineage OS Updater aserver stuff
	ProxyRequests Off
	ProxyPreserveHost On
	
	ProxyPass /LineageOS/ http://127.0.0.1:5000/
	ProxyPassReverse /LineageOS/ http://127.0.0.1:5000/
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
And localhost/LineageOS will not work. I have enabled the proxy and proxy_http modules, and when I had your code in VirtualHost *:80, it didn't work either.
I used this guide to decide what file to edit. Have I missed something out? was I meant to change some of the other files as shown in the guide?
127.0.0.1:5000 still works.
 

Charles IV

Senior Member
Jan 15, 2016
566
179
73
I think you are totally offtopic here. There is no python dependency on this project.

You are trying to use the LineageOS official OTA server, although this is the wrong thread. Sorry, can't help you.

Sorry, and I completely understand your point.
I was replying to @Deltadroid's post about this, hoping he could help me.

However if I set cm.updater.uri to my_ip/LineageOTA/api, the updater app still shows connection error, despite being able to access my_ip/LineageOTA in my tablets browser.
Please note I have moved the LineageOTA folder from /var/www to /var/www/html, as otherwise I get a 404 error, from whichever device I try to access it from.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 35
    Hi guys,

    today I would like to present to you a simple project that was born on this thread to accomplish a very simple task: since there are thousand of Custom ROMs around here, so much of them are LineageOS based, and because of this their forced to build every time all the ROM and post updates here. Users are also forced to check if their preferred ROM was updated or not. That's why I decided to understand how LineageOS OTA Updater System App works. Because of this I've wrote a simple REST Server API emulation that fully works with your ROM (if integrated of course). How? Continue reading down here.

    How does it work?

    Of course is as simple as it should be. Clone the repo (is a simple PHP website that you can host on any shared hosting*/VPS that you like) and upload it into your preferred hosting. That's it. If you point your web browser to that address the App is already working.
    After, you have to upload all your build to the _builds/ folder, and you're done.

    The two already working calls /api and /api/v1/build/get_delta should answer correctly the updater app to make it work (remember that visiting it as a browser is not sufficent).

    How to integrate it with my ROM?
    You have two options:
    - Declare cm.updater.uri on your own build.prop file with the value of you own server URL where you have deployed it (This can be done also by the user with any Android App from the Market)
    - Replace the string conf_update_server_url_def value inside values.xml of the OTA App source code (COMPILE TIME ONLY!)

    Which builds does it support?

    Anything that will be borned by the official guide on how to build your custom LineageOS ROM! So, in poor words will be: stable, rcs, nightly and snapshots (likely called EXPERIMENTAL), from CM7 to CM14.
    Delta updates SHOULD work too. Just try it and tell me if they works :)

    How can I debug it?

    You can use this simple UnitTest that I've already pushed into my GitHub. Feel free to use it everytime you need. It's based upon NodeJS and Unirest.

    Is it free?
    "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer."
    —Richard Stallman

    Use it as you want, do anything you want with it as it's MIT licensed.

    Is it free of bugs?

    That's why I'm here :) Only you can help me to squash all the remaining bugs!

    I hope this will be useful to anyone of you, helping the ROM community providing a simple OTA updater that already works on LineageOS official ROMs.

    Greets.

    ---

    Project Home: https://github.com/julianxhokaxhiu/LineageOTA
    More about the study: http://blog.julianxhokaxhiu.com/how-the-cm-ota-server-works-and-how-to-implement-and-use-ours
    Changelog Build Scripts ( thanks to @Deltadroid ): https://github.com/syphyr/cm_build_scripts/blob/master/make_changelog

    * On a Shared Hosting you can ONLY provide a FULL ROM download, NOT DELTAs!

    ---

    Donators:
    - @BlueFlame4 x2
    14
    All right, for anyone still reading this thread, I pushed out two updates, but I sugget you to use always the latest :)

    You can download the newest version of course on the Github repository as well as from composer. I hope this will help you on deploying as fast as possible OTAs to your ROMs!
    4
    New update 2.0.8 available on Github and/or Composer :)

    Changelog:
    - Adding support for LineageOS CMUpdater ( this should not break current CM ROMs support, if yes please create an issue! )

    PLEASE TEST AND PROVIDE FEEDBACK! Retrocompatibility with CyanogenMod should still be there, but we will have LineageOS support on top of it quite for free i would say. No real big changes, everything should work out of the box :) Unit Test is also updated to easily verify if your OTA server is correctly running.

    Last but not least, if you're Docker fans you'll find a new Docker for the OTA Server that can just ramp up your OTA in minutes completely up and running :) See https://hub.docker.com/r/julianxhokaxhiu/lineageota/

    Enjoy!
    3
    Need help with development

    First I would like to thank you for using this product and playing with it (which involves patching, testing, etc.).

    Since the first post I've made here in XDA the project evolved a little since I rewrote entirely the project to make it composer friendly. Rather than that, the Delta build process is actually non working (I tried to create a ZIP but I don't have enough knowledge in ROM development to tell if it's enough or not) so it's just a WIP layer that should be addressed and fixed (I've already found a Python project which does this already but I'm of the idea that this should be somehow not be a bloated software that needs to install binaries here and there to make it working).

    So, actually I'm not really working in this project but It's in my TODO list, meanwhile I'll be very happy to have pull requests with useful patches to make this KK, LL and more compatible :) So feel free to contribute and thanks again for using it!
    3
    I have it working. I'll upload mine to github tonight
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone