ElkArte Community

Project Support => Support => Topic started by: Adrek on December 25, 2015, 01:59:16 pm

Title: How to setup package servers in ElkArte?
Post by: Adrek on December 25, 2015, 01:59:16 pm
I tried to do it long time ago with SMF, but it never worked for me. Server was visible and I could look trough package list, but it wasn't possible to download anything.

Can someone make small description how to create working package server in ElkArte?
Title: Re: How to setup package servers in ElkArte?
Post by: emanuele on December 25, 2015, 04:13:45 pm
I think @Spuds is the one to chase for that info. :P
Title: Re: How to setup package servers in ElkArte?
Post by: wintstar on December 25, 2015, 04:48:57 pm
Do you mean,  download via the package manager in the Admin center? For me it works :)
Title: Re: How to setup package servers in ElkArte?
Post by: Adrek on December 25, 2015, 04:52:07 pm
yeah, but I want to create own server :)
Title: Re: How to setup package servers in ElkArte?
Post by: Spuds on December 25, 2015, 06:25:18 pm
At some point I should do a write up on how to do this, would be a good wiki article, but for now the fast high-level summary is this.

The addon site is a Jekyll based site, hosted on GitHub.  Jekyll is a static site builder, it builds sites using templates written using its language which allows for looping, logic, to name a few.  In building the site Jekyll runs the templates and it creates all of the static pages that get served (the created files are in _site, you will not see that in the repo itself)

Jekyll docs are here http://jekyllrb.com/docs/home/ You can see how we have addon site setup here: https://github.com/elkarte/addons/tree/gh-pages  Those our our templating files, they will makes sense if you go through the Jekyll docs.

Whenever an update is pushed to the addon gh-pages repo Jekyll automatically rebuilds all the static site with the updates, you don't have to do a thing. Just to note, Jekyll will run/build any file it finds in the repo root as long as it starts with a Jekyll front matter section (see the Jekyll docs)

As part of the build process it creates a json file of the addons.  To do that check this template file https://github.com/elkarte/addons/blob/gh-pages/package.json  The output of that template file is the static file http://addons.elkarte.net/package.json  Its this file that ElkArte reads, parses and presents in the package server area.

For a package server you don't necessarily have to have a Jekyll site, all you really need is a way to serve up a json file that follows that structure. This could be done with php as well, its just a json array object.  You can choose to host the addon package files or simply point to where they are hosted. 

So simply a package server is nothing more that a url that returns a json file structured as defined above.
Title: Re: How to setup package servers in ElkArte?
Post by: ahrasis on December 26, 2015, 01:06:13 am
I did that once in SMF but not an automated one. I think it was rather xml last time. The best package server would be an automated one as suggested by Arantor.
Title: Re: How to setup package servers in ElkArte?
Post by: Joshua Dickerson on December 26, 2015, 12:11:31 pm
What is an automated package server? It's just a file.
Title: Re: How to setup package servers in ElkArte?
Post by: Spuds on December 26, 2015, 04:11:26 pm
And that static JSON file is automatically generated/updated whenever a addon is added / updated via commits to the addon site.