Closed maggie44 closed 3 years ago
*added these endpoints to dev-env
So, let me try to recap to make sure I've got this right:
Then some of my questions:
http://variablehostname.local/portainer
hostname a little ugly for public access? How does one upload their files into the Portainer container?
Portainer pulls from Docker Hub or your own private hub. It’s basically a control panel for using Docker. So make your own container, publish it to docker hub or upload it through Portainer and run it. Use case, I start with a Ubuntu container on my local system, setup pm2 and your backend, upload that container to Portainer on LB with the port exposed and now as an LB user I have a node backend running there.
Do you believe someone would use both the website and the Portainer functionality?
Website is far simpler. Upload a HTML file, or transfer your php pages from an existing site. Many basic edtech resources are also already written in basic html (see some of the resources from oer2go.org). Simple copy and paste for these. Docker use and container management is far more complex.
Isn't the http://variablehostname.local/portainer hostname a little ugly for public access?
When I write variablehostname in posts I mean %variablehostname%. So that isn’t actually the host name. The Portainer path by default is lb.local/Portainer. But someone may have changed their host name to myblock so myblock.local/portainer. I just write variablehostname to indicate that this cannot be a static address hard coded into the app.
The software is called Portainer and is well known in the docker community, so stuck just with /Portainer
Thinking ahead, it may be worth adding something in that allows for us to easily add in buttons like this, relying on the api in the same way, if it’s easier than having to code in new things each time.
So, let me try to recap to make sure I've got this right:
- [ ] Advanced users can use the LB to host their own website/app/whatever via Portainer
- [ ] Our interface should let them see the status of Portainer
- [ ] Our interface should let them start or stop Portainer based on the return status response
Then some of my questions:
- How does one upload their files into the Portainer container?
- Do you believe someone would use both the website and the Portainer functionality?
- Isn't the
http://variablehostname.local/portainer
hostname a little ugly for public access?
Yes to 1 and 3 of the checklist. But not to 2, users won't need to see the status of Portainer, that endpoint is only so that the button will know which state to be in.
LB now has Portainer added in: https://github.com/LearnersBlock/controller/issues/4
This will allow the more techy minded to run their own containers with anything they want in them on the device. An example use case might be you would run a container with a Node backend in it, and then use it for the website you have added to the 'website' function of the device.
By default, Portainer is not running, and doesn't start after a restart. This makes sense as a default option, as it's use is going to be minimal, and can run one less container.
Which means in the Advance section of the settings panel we need to add a switch to start it. Here are the three API endpoints:
When calling the 'status' endpoint, the API will return:
{"status": 200, "message": "Running"}
Any other 'message' is it is not running. There could be multiple, 'failure', 'exited' to name a few, dictated by Balena OS, so probably better to just check for 'Running' and anything else return that it's offline.
When Starting or Stopping portainer, the API will will return
{"status": 200, "message": "OK"}
on success.There will also need to be a link in there to redirect people to the running Portainer, which is on: http://variablehostname.local/portainer