Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #1170

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Docker #1170

wants to merge 9 commits into from

Conversation

squatica
Copy link

@squatica squatica commented Feb 7, 2020

Hi,
building on top of the PR #1162 updated the branches with current master and joined mine and @akash07k 's changes together into this PR. I suggest to squash all the commits together (maybe except deasync and '--dev'), because it's pretty confusing as it is. I left them separate for now just in case you prefer to look at all the single commits.

@squatica
Copy link
Author

@jtojnar What do you think? Can it be merged? Or anything else necessary?

Copy link
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR and sorry I did not get to this yet.

From a glance it looks mostly okay except few things – there are too many extra files in the root of the repository. I am already trying to remove things (#913) and plan to continue in the future. Are you absolutely sure none of these files can be moved to utils subdirectory?

Maybe at least the .dev.yml could be moved since it already needs to be referenced explicitly.

Also the dockerfiles themselves look incredibly complex. I wonder if it would be okay to just use PHP’s built in server instead of Apache.

.dockerignore Outdated Show resolved Hide resolved
.env.dist Outdated
@@ -0,0 +1,2 @@
UID=1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there not a better way to mount the dev directory without needing uid/gid? Not only this adds to the clutter but it also feels a bit wonky.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this is a years-long issue with docker and volumes - moby/moby#2259. And in this case we need the executor of npm run dev to match the owner of the mounted directory, which can be anything. This solutions is one of the least complicated and working.

README.md Show resolved Hide resolved
@@ -1888,10 +1888,13 @@
"dev": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be part of this PR. Will cherry-pick to master.

@@ -26,7 +26,7 @@
"fix:server": "composer run-script fix",
"install-dependencies": "npm run install-dependencies:client && npm run install-dependencies:server",
"install-dependencies:client": "npm install --production=false --prefix assets/",
"install-dependencies:server": "composer install --dev",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

utils/docker/entrypoint.sh Outdated Show resolved Hide resolved
@squatica
Copy link
Author

OK, I tested how it works with docker-compose files in utils/docker and it seems to be fine. It's not standard but works.

About Apache - I'd rather keep it, because there are a bunch of .htaccess files which will all stop working under php builtin server. Also php builtin server should not be used for production. What do you find complex about the Dockerfiles? They seem quite small to me, I've seen much worse :-D The production one is split into three parts using multi-staged build because we don't need npm nor composer for the production runtime environment. And the dev dockerfile basically only installs node and composer according to their official installation instructions. One minor simplification will become possible once the config.ini location is configurable or moved into data directory as suggested by #913 .

@akash07k
Copy link
Contributor

Thanks a lot @squatica for this.
It's working great so far.
Actually I was out of station so couldn't pay attention to it till now.
Thanks a tons for your efforts into this!

@squatica
Copy link
Author

Hey @akash07k nice to hear from you again, I was worried what happened to you 😃

@jtojnar I created a docker hub account for selfoss, I'm going to configure automatic builds of the production image. Let me know how I can transfer the ownership to you.

@akash07k
Copy link
Contributor

@squatica
Yes buddy. actually I went on vacations for sometime and my laptop wasn't with me.
I'm back now.
how are you?
and I'm very greatful for you for your efforts.
I pinged you on gitter a month back but probably you were busy then.

Hey @akash07k nice to hear from you again, I was worried what happened to you 😃

@jtojnar I created a docker hub account for selfoss, I'm going to configure automatic builds of the production image. Let me know how I can transfer the ownership to you.

@akash07k
Copy link
Contributor

Isn't it yet ready for merge?

@jtojnar
Copy link
Member

jtojnar commented Mar 28, 2020

The main blocker is that we do not have anyone knowledgable in Docker to properly review this.

@akash07k
Copy link
Contributor

akash07k commented Mar 29, 2020 via email

@kolaente
Copy link

kolaente commented Apr 7, 2020

Looks quite good, I have a few ideas:

  1. I would suggest creating the dev image on top of the production image - that way you get the benefit of having the same docker image for dev and prod (well, almost at least).
  2. Another approach would be to have a seperate "workspace" container which contains all the tools needed for development (composer etc) and has the same mounts as the prod image. Both would run side by side, but the prod image based container would only host the files - and be the same as any "real" prod deployment. This one would then also do things like running the frontend watcher on startup.

@akash07k
Copy link
Contributor

akash07k commented May 1, 2020

Looks quite good, I have a few ideas:

  1. I would suggest creating the dev image on top of the production image - that way you get the benefit of having the same docker image for dev and prod (well, almost at least).
  2. Another approach would be to have a seperate "workspace" container which contains all the tools needed for development (composer etc) and has the same mounts as the prod image. Both would run side by side, but the prod image based container would only host the files - and be the same as any "real" prod deployment. This one would then also do things like running the frontend watcher on startup.
    Good ideas,
    I'm not that expert in Docker otherwise I would have tried working on these.
    @squatica opinions bro?

@akash07k
Copy link
Contributor

akash07k commented May 1, 2020

It seems that now there are some package conflicts in package.lock.json due to the dependency updates. :-)

Akash Kakkar and others added 9 commits May 16, 2020 10:39
Hi guys, I'm still alive.
I rebased this PR on top of the current master & solved the conflicts.
I'm looking into @kolaente's remarks, it should be possible so I'll do it.
Unfortunately I lost access to my email and github started asking
for email verification, so I cannot login to github web, but I can still commit.
Hopefully the support will let me recover the account.
If not then I'll have to continue under different username.
@desaintmartin
Copy link
Contributor

Hello,
An official container image would be really nice (and I may even build a Helm Chart for Kubernetes on top of this). Could we help in anything in order to have this merged and the image automatically built/published somewhere?

@jtojnar
Copy link
Member

jtojnar commented Oct 11, 2021

Sorry, I do not really use docker so it has been difficult for me to allocate time to it. I will try to do something with #1271 this week.

@armandabric
Copy link

If you need some help with it, I'm running https://github.com/armandabric/docker-selfoss since few year now. I hope it could help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants