- Status Unconfirmed
- Percent Complete
- Task Type Feature Request
- Category Installer and Upgrader
- Assigned To No-one
- Operating System Linux
- Severity Low
- Priority Very Low
- Reported Version 1.0-rc10
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#2649 - Docker Container: is there a way to hook into the setup from CLI?
Hi, in my free time of the last few days I begun developping a Docker container: https://github.com/blu-base/flyspray-docker. I derived it from a nextcloud docker container… For now, I limited my focus on an apache/debian buster container. I’d be happy to contribute the project to the official placeholder when it is ready.
Anyhow, in the entrypoint script, I use some environment variables to create the flyspray.conf.php
from scratch. and would now need to populate the database. I understand i have to use the respective xml scheme as the setup/index.php
does.
I am not experienced with php and database applications and would like to ask you for advice how to proceed efficiently.
Since the current setup is indented to be interactive in the browser, i would need to use a cli tool or a purposely-build php script to do the same task on the command line/on container startup. But this seems to me this would be code duplication and introduce more maintenance work.
- Is it possible to hook into only some of the functions of the
setup/index.php
? - What could be the next best approach to populate the db on first start?
- Would it be a viable solution in trying to further modularize the setup - allowing to run parts on cli, like nextcloud’s
occ
tool?
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
In parts this WIP is trying to add a respective feature for future releases.
Though the question would still be valid for the last couple of releases.
You might sent POST requests to trigger the setup install steps.
This are portions of logged setup steps with Selenium Firefox browser plugin.
Either use curl from shell or use PHP's curl_* functions.
or
Do not forget to replace the file for Postgresql as the official 5.21 ADOdb postgres driver ist not working with the xmlschema03 stuff required for Flyspray.
Instead required to copy setup/upgrade/1.0/datadict-postgres.inc.php to vendor/adodb/adodb-php/datadict/datadict-postgres.inc.php until an official ADOdb releases fixes this.
Thanks for this thorough guide!
I'll likely implement this in the coming days.
Posting the information does work. I only had to split one of your suggestions. The action administration needs to be executed separately since the db populating happens in the previous stage.
There is on conceptional problem, though. The apache server in the respective docker container is started in the very end of the entrypoint script. It means, i cannot curl the web root before that… I'll need to figure out a way to maybe temporarily start the apache server with the proper settings…
Well, it was just snippets of an experiment I made 2 years ago. So my posted code was more to get an idea of one way how it could be done, not meaning it is the best way to do to automate setup.
I stick to vagrant boxes for testing, mostly using Debian and OpenSUSE boxes.
I didn't mean to sound like complaining. The previous post was meant to be an information on what i learned.
I found the dangling repo on the flyspray docker and thought, this might be something i am able to contribute.
All fine.
Yea, I created placeholder https://github.com/Flyspray/flyspray-docker
But I am not familiar with Docker and can only help on database or PHP topics.
It took a bit longer than anticipated to find time.
Anyhow, I have commited likely functional tool set to initialize non-interactively.
For reference, the curl commands in the previous comment needed to be extended to catch and submit the php session cookie.
In order to run the curl commands after the apache process has been initialized, i had to do a somewhat ugly process fork in the entrypoint script (the startup script for the docker container). Lacking an idea for an elegant way to wait for the db container to start up, i inserted a sleeping step as well…
Nevertheless, the default setup seems to be initialing satisfyingly now. https://github.com/blu-base/flyspray-docker
More testing is likely needed for edge cases and implement some automatic upgrade paths.
@bbase
FS#2652Maybe related and you can verify that?I tried
inside a vagrant opensuse box, but it ended like this:
As I am not using or familiar with Docker, what is the proper way to build/run it?
The Dockerfile needs the other files in the same directory. With getting only the Dockerfile it will not be possible to include the required scripts into the docker image. It is simpler this way than 'hard-coding' to curl a remote address instead.
You either download the whole directory first.
Or otherwise download the Dockerfile, entrypoint.sh, cron.sh, and upgrade.exclude into the same directory (the latter doesn't do much yet). Then run the following from that directory.