how can i use this when running ghost as docker container?
Closed this issue · 5 comments
i am running ghost as docker container and will like to use S3
How do i accomplish this?
Thanks
I'm not sure, I don't use docker. Maybe @necevil can give you a few pointers.
@babatundebusari not too tough if you already have Ghost running and you are comfortable creating a Dockerfile and Building a fresh container yourself.
The two tricky parts are:
- Choosing how you want to manage downloading the module from NPM
- Changing the permissions on the NPM files you just added to your custom container so that they are owned by the correct user (which in the case of the official Ghost container is: 'user')
Both of those require you to create a new Dockerfile (over and above the official Ghost dockerfile). There is no way to do it without creating a new Dockerfile.
Some of this stuff is going to be relatively moderate in docker difficulty (relative to other stuff I have tried) so if you aren't interested in learning it / trouble shooting / researching I would probably not go with any S3 module use with Ghost. (Won't matter which one since the same steps are required regardless of which NPM S3-Ghost module you use)
If you are a beginner, there be some moderately small, probably slayable, dragons (assuming you are prepared to tackle them keep reading).
I chose to download all of the NPM modules I use with ghost (including the S3 adapter) to my Docker Host (my OSX laptop). I had to do that from within the official Ghost Docker container to make sure NPM got the version that matched the operating system official Ghost expects to use (you can see the official ghost Dockerfile on github: https://github.com/docker-library/ghost/blob/2abbd2be17b1f1418b2195ee60801585149d7b4a/Dockerfile).
That meant that I had to start a container (using the official ghost dockerfile) but this time as a throw away that would only download the NPM module and then place it / make it available to my host operating system using a mapped volume.
On a quasi related note:
I am running a production site that has real money depending on it, I choose to keep my NPM modules in a separate Git sub-module repository. For you you probably don't need to check your NPM modules into source and there are a ton of people who choose not to.
Once I had the NPM module(s) on my host computer, I then wrote a new Dockerfile in which I use the Dockerfile COPY command to add my NPM modules to my container, at which point you need to Chown all the NPM modules to the correct user using the same command that the Official Ghost Dockerfile uses which is:
RUN chown -R user:user
My Dockerfile has a fair amount of customizations that are NOT done in the tradition of good docker development due to how I need to integrate Ghost with our GitLab-Ci build pipeline. That being said I am hoping to at some point write all of this up in a blog with a properly maintained container that everyone can use and just be done with this problem.
Happy to help in the mean time but I don't have a plug and play solution for you!
Hope life is good @colinmeinke
@necevil awesome response, thanks so much for taking the time!
@necevil
ok thanks..seems custom docker image is the only way
i can do that..was just trying to avoid the custom image thing
One last thing
do you know if ghost plan to support the external storage (like s3) as built-in soon?