PartKeepr icon indicating copy to clipboard operation
PartKeepr copied to clipboard

Create a fixed environment container (with docker for e.g.) to support starting developers or testers.

Open Boldie opened this issue 5 years ago • 23 comments

We shall provide an easy to use environment and also a reference environment to support testing and developing. Common used tasks shall be made easy accessible for e.g. using a shell script or similar thing. For e.g. the following stuff shall be possible:

  • Load demo data to a database
  • Complete setup including easy to use database setup.
  • "One-Click" installation and then use for development or testing.
  • It is not intended for the usage as a first priority, It can be used but the focus shall be on the development and testing site.

I suggest to make a docker container for this stuff.

Boldie avatar Feb 13 '20 22:02 Boldie

Maybe this is also related to #1041 #1066

Boldie avatar Feb 13 '20 22:02 Boldie

There is a docker container managed by mhubig. Although I'd like to see it be under official namespace of partkeepr. But this is merely for production and not for development.

One problem is that there needs to be a way to run the setup without calling a set of web sites. This is needed as (at the moment according to my understanding) nobody except for @Drachenkaetzchen knows exactly what happens during setup routine. This needs to be done manually in order to make automated builds and tests possible.

christianlupus avatar Feb 14 '20 06:02 christianlupus

It would be much more convinient to do a docker-compose with PostgreSQL. And you can export demo site to .sql files (from normal installation) and then import them inside database during intialization.

  • What about windows users ?
  • What about *pi users ? It would be nice to have embedded database that would not take a lot of space.

shafr avatar Feb 14 '20 07:02 shafr

This is needed as (at the moment according to my understanding) nobody except for @Drachenkaetzchen knows exactly what happens during setup routine.

Well, the code is there.

Also, all setup does is to generate the config.php file and wraps symfony commands to setup the environment. See https://wiki.partkeepr.org/wiki/Running_PartKeepr_from_GIT#Updating

Drachenkaetzchen avatar Feb 14 '20 12:02 Drachenkaetzchen

Well, that is a good source of information. Thank you for the hint @Drachenkaetzchen.

christianlupus avatar Feb 14 '20 12:02 christianlupus

Just a small question at @Drachenkaetzchen and @dromer. Where would we put such files? Some repos I have seen use a subfolder, other use a complete own repo for all sort of CI/CD. What would be your preference for partkeepr? Maybe I can do something here but I want to avoid make the work twice.

christianlupus avatar Feb 15 '20 07:02 christianlupus

I agree with @shafr that a simple docker and/or docker-compose file should be enough to get going.

However it is important that there is a volume mounted for any assets and cache that partkeepr needs. Usually everything is self-contained with docker, but in this case a mounted volume is quite necessary.

dromer avatar Feb 15 '20 10:02 dromer

@christianlupus I think a dockerfile in the root should be fine. Unless it becomes a 'collection' of files then a subdir to keep it a bit neater.

dromer avatar Feb 15 '20 10:02 dromer

Well using docker image for composer:1.9.3 causes issues with packages:

  Problem 1
    - Installation request for fr3d/ldap-bundle dev-master -> satisfiable by fr3d/ldap-bundle[dev-master].
    - fr3d/ldap-bundle dev-master requires ext-ldap * -> the requested PHP extension ldap is missing from your system.
  Problem 2
    - Installation request for moontoast/math 1.1.2 -> satisfiable by moontoast/math[1.1.2].
    - moontoast/math 1.1.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
  Problem 3
    - Installation request for nfq-alpha/sprite-bundle dev-min-image-fix -> satisfiable by nfq-alpha/sprite-bundle[dev-min-image-fix].
    - nfq-alpha/sprite-bundle dev-min-image-fix requires ext-gd * -> the requested PHP extension gd is missing from your system.
  Problem 4
    - Installation request for zendframework/zend-ldap 2.5.1 -> satisfiable by zendframework/zend-ldap[2.5.1].
    - zendframework/zend-ldap 2.5.1 requires ext-ldap * -> the requested PHP extension ldap is missing from your system.

I'm not sure how php composer package system works, but when I tried adding manually missing packages, it had no effect.

Seems like that alpine OS packages are missing (or there were never compiled for that OS). Most likely the best way to do installation is to use clean ubuntu image or ubuntu + php7, then install missing packages:

sudo apt-get install php7.0-gd
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-xsl

and use it as builder.

shafr avatar Feb 20 '20 08:02 shafr

At the moment I am working on a patch in my personal fork. Yesterday I successfully installed it but found that the GitHub Packages docker system does not provide anonymous access to public packages (See this discussion). So I need to rework things a bit.

There are still some open things to do but especially I do not (yet) have a database dump to import in case of development to have some dummy entries.

christianlupus avatar Feb 20 '20 08:02 christianlupus

I managed to get "something" running. As soon as I commit something to my master branch or add any tag, a new build is triggered. This time I use dockerhub as it allows everyone to download the generated images without any credentials.

@dromer Do you prefer to have a clean history in a potential PR or are you going to squash anyways? Otherwise I have to rework my branch history :smirk:.

christianlupus avatar Feb 20 '20 13:02 christianlupus

Depending on the amount of lines we can squash it (if it's just a concise config or 2 that would be fine). Separate Dockerfile.yml and docker-compose.yml would be nice.

dromer avatar Feb 20 '20 14:02 dromer

I opened PR #1088. However, I need #1085, which is thus a subset of #1088.

You might want to have a look at the PR and tell me if you are willing to squash or if I should rework the history.

christianlupus avatar Feb 20 '20 15:02 christianlupus

Depending on the amount of lines we can squash it (if it's just a concise config or 2 that would be fine). Separate Dockerfile.yml and docker-compose.yml would be nice.

No squash is needed - rather use multi-stage builds

shafr avatar Feb 21 '20 14:02 shafr

@shafr we where talking about git commits. and also I don't see how multi-stage Dockerfile is relevant here.

dromer avatar Feb 21 '20 16:02 dromer

@Drachenkaetzchen To have a more detailed docker image, I'd like to add quite some testing data there. Would you be ok, if we added the test data from the demo page there? Of course, we would remove your personal account from the SQL dump to avoid any leaking of password hashes and replace it by something general (that can be published).

christianlupus avatar Mar 02 '20 13:03 christianlupus

The demo site is already cleaned out of personal data I think. Do you have access to the dump?

Drachenkaetzchen avatar Mar 02 '20 14:03 Drachenkaetzchen

Unfortunately neither to the SQL dump nor to a file system dump of the data folder. Otherwise, I would have added these as example data in the docker PR. Are these large? Maybe you can send me the dumps? If required, I can send you a link to my personal NextCloud instance so no big mails need to be sent around.

christianlupus avatar Mar 02 '20 15:03 christianlupus

Here are the sql dump and the data files: https://cloud.drachenkatze.org/index.php/s/6WJWp9t9qRqwzrx

Drachenkaetzchen avatar Mar 02 '20 18:03 Drachenkaetzchen

Thank you, I downloaded the files. Are you keeping the link open in the future? Otherwise you can close it now.

christianlupus avatar Mar 03 '20 08:03 christianlupus

No, I don't have a huge amount of disk space so I'll remove it now.

Drachenkaetzchen avatar Mar 03 '20 18:03 Drachenkaetzchen

@christianlupus Did you succeed in making a working docker image?

Boldie avatar Jun 21 '20 21:06 Boldie

@Boldie At the moment there is #1088 that goes into this direction. You can check out the relevant commits and use them my temporarily merging (locally) with your dev branch. Unfortunately, I am a bit short of thime these days. There are some edges and I might need to work over it once again.

christianlupus avatar Jun 22 '20 13:06 christianlupus