Replies: 4 comments 6 replies
-
Hi Miro, we've actually spent a fair amount of time working on the question
of Docker for a development environment. In development, a volume for
mongodb is not enough. You really want a volume for your actual code too,
so you can develop your project and have it persist on your hard drive.
We were looking into creating an all-purpose Docker dev environment for
everyone using volumes. However the fatal flaw is that "npm install" is
just incredibly slow on shared volumes when the host OS is not Linux. In
general, shared Docker volumes are slow on non-Linux hosts. Good enough for
persisting mongo, but terrible for "npm install" or even for apostrophe
process startup (all those "require" calls). This is true even when using
more relaxed syncing settings for the volume.
One alternative is to run unison, but unison is a hard install on the host,
which defeats the purpose of using Docker.
So I created this workaround:
https://github.com/boutell/docker-dev
I was excited about it, because it could potentially work across platforms
with no tricky installs on the host.
But then I started running into fatal errors from "unison" that I could do
nothing about without becoming a unison core developer (:
When I google about it I see many people drawing the same conclusions.
We absolutely could use Docker as a dev environment for Linux hosts only.
However, Linux hosts are also the place where the instructions to just
install node and mongodb on your system via the package manager are
simplest. So while it might be worth it, it is not the huge win we first
thought it would be.
Instead, we are going in the direction of writing an Ubuntu Linux HOWTO
that eventually also works, with few or no changes, on Windows Subsystem
for Linux (which is also Ubuntu). MacOS would still have a separate HOWTO.
But I absolutely welcome your thoughts on how we might overcome these
issues in a better way. It is a hard problem.
(P.S. Speaking of Docker volumes, in addition to MongoDB, in production you
still need a volume for uploaded media unless you're using S3 or similar.)
…On Wed, Jul 28, 2021 at 8:32 AM Miro Yovchev ***@***.***> wrote:
I've just met a confused person coming from the PHP world, who wasn't able
to boot up an Apostrophe app on a local machine following the official getting
started guide <https://v3.docs.apostrophecms.org/guide/setting-up.html>
I think there is a room for improvement here when it comes to meeting the
system requirements and especially MongoDB and NodeJS. A typical and easy
to setup environment for Linux (and I believe MacOS as well) would be
docker compose and nvm.
Docker has very good installation documentation for every OS so it can be
directly linked. When it comes to MongoDB a template docker-compose.yml
file like this one could be embed in the docs:
version: "2"services:
mongo:
image: mongo
restart: unless-stopped
volumes:
- mongodb-data:/data/db
ports:
- "27017:27017"
expose:
- "27017"
volumes:
mongodb-data:
with docker-compose up -d and docker-compose down for respectively start
and stop the mongodb instance.
The nvm tool has even more simple installation procedure (via remote bash
script) for *nix systems (completely in the dark about Windows development
environment though, haven't do that 10+ years). The only thing left is the
nvm command to download and setup as default (or via ,nvmrc project file)
the correct NodeJS version.
Of course, something already discussed I guess would be a ready to go
Apostrophe docker image and/or docker compose running both mongodb and the
local app and while this is solid option, I think the above would be great
for people to understand the semantics.
I think meeting the environment requirement is a showstopper for newcomers
previously using another technologies and it would be great if they don't
get stressed by that. I'll be glad to assist with whatever I can regarding
the most possible simplified instructions for Linux systems (although I'm
sure you have enough experience there :) )
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3262>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27PMXPW43NPKLOLHGQ3TZ72FVANCNFSM5BEIPSFQ>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
-
BTW, was your confused person running on Windows, Linux or MacOS? |
Beta Was this translation helpful? Give feedback.
-
Thanks for clarifying Miro. I think we are actually not that far apart on this subject 😂 It sounds like the only real question here is whether to recommend running MongoDB in a docker container, or by installing it on the host Linux OS via the package manager. There is official documentation for that, but it does take a few steps. Docker might be easier, and running Docker commands under Windows Subsystem for Linux does appear to be a possibility, although a detour to set that up would be required. |
Beta Was this translation helpful? Give feedback.
-
Apostrophe runs great when dependencies are installed via homebrew on Mac
instead, but it's not a fast Docker host, no.
…On Thu, Jul 29, 2021 at 7:42 PM Miro Yovchev ***@***.***> wrote:
Yes, I can confirm this happens occasionally. Never happened to me
(Ubuntu), I saw it few times on my colleague laptop (MacOS). One more
reason to think twice before buy a Mac.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3262 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27JBKH5ITDJ5JHPTEEDT2HRNZANCNFSM5BEIPSFQ>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
-
I've just met a confused person coming from the PHP world, who wasn't able to boot up an Apostrophe app on a local machine following the official getting started guide
I think there is a room for improvement here when it comes to meeting the system requirements and especially MongoDB and NodeJS. A typical and easy to setup environment for Linux (and I believe MacOS as well) would be docker compose and
nvm
.Docker has very good installation documentation for every OS so it can be directly linked. When it comes to MongoDB a template
docker-compose.yml
file like this one could be embed in the docs:with
docker-compose up -d
anddocker-compose down
for respectively start and stop the mongodb instance.The
nvm
tool has even more simple installation procedure (via remote bash script) for *nix systems (completely in the dark about Windows development environment though, haven't do that 10+ years). The only thing left is the nvm command to download and setup as default (or via ,nvmrc project file) the correct NodeJS version.Of course, something already discussed I guess would be a ready to go Apostrophe docker image and/or docker compose running both mongodb and the local app and while this is solid option, I think the above would be great for people to understand the semantics.
I think meeting the environment requirement is a showstopper for newcomers previously using another technologies and it would be great if they don't get stressed by that. I'll be glad to assist with whatever I can regarding the most possible simplified instructions for Linux systems (although I'm sure you have enough experience there :) )
Beta Was this translation helpful? Give feedback.
All reactions