meteorhacks / meteord

MeteorD - Docker Runtime for Meteor Apps for Production Deployments
https://registry.hub.docker.com/u/meteorhacks/meteord/
MIT License
439 stars 371 forks source link

Meteor 1.3 support #78

Open markshust opened 8 years ago

markshust commented 8 years ago

Right now, it appears meteord just hangs/fails when attempting to build for the latest 1.3 beta 5. Are there plans to make this work with 1.3, including the new npm support?

FYI this may also be related to why it's not building https://github.com/meteor/meteor/issues/6115

markshust commented 8 years ago

FYI, figured out build problem. However, any npm modules that are in the new package.json aren't getting installed.

arunoda commented 8 years ago

Hmm. May be we need to do it in on-build. On other builds we could assume, it's done by the user. @jshimko what do you think?

jshimko commented 8 years ago

Well, MeteorD works fine for me with a 1.3-modules-beta.4 app that I have, but I just upgraded that working 1.3-modules-beta.4 app to 1.3-modules-beta.5 and it appears to have broken a bunch of things. So I suspect there's possibly more to it than what's happening in the container build.

To answer your question @markoshust, yes, we'll absolutely get MeteorD working with 1.3. We may just have to wait a little for the dust to settle with the 1.3 release. Each new beta release has brought a new set of problems for me, so I've put that on the back burner for a bit so I can actually get some work done. :)

Certainly open to a pull request if you figure it out though. Perhaps we should start another branch for 1.3-beta stuff and merge it once 1.3 is official?

arunoda commented 8 years ago

@jshimko Yeah I agree wth that plan. 1.3 update5 kind a break things a lot. We should wait a bit.

markshust commented 8 years ago

@jshimko @arunoda I have a custom Docker image running pretty straight-forward with 1.3.

For meteord, everything working ok, other than the missing node modules not installed with my user-set packages.json.

I'm trying to understand base vs binbuild vs devbuild vs onbuild. What is a detailed explanation for each? I tried digging through the code, but with the few Docker images I'm a bit lost as to what exactly is going on and when.

Regardless, I made a PR for this, so you can see what I'm doing in my custom Docker image. Basically, I'm just installing from source code directory and moving the installed node modules to the new bundled directory, before those node modules are installed. It works for me and is a good easy fix. Again, I wasn't 100% if this was the only place this needed to be added.

markshust commented 8 years ago

I think you are correct, should probably wait a bit longer at least until next release. I managed to build the app, get the modules installed and server loads correctly with no errors, but client doesn't load user-defined npm modules (even though server does now).

markshust commented 8 years ago

I figured this out. What I did is install the programs/server node modules, then move them into a 'general' directory inside the core app folder. Then, I copy out the package.json file that could be created by the user for any custom npm modules that are installed. Then, I symlink everything back to the programs/server, programs/web.browser and programs/web.cordova folders, so everything shares the same node_modules folder.

There needs to be some checks added in the case the custom package.json doesn't exist, or if web.cordova doesn't exist (not sure if this is always created, or just for cordova projects). Hope this sends on the right path.

Here's my full custom node Docker image which may help simplify what is going on here.

FROM markoshust/nodejs:0.10.41
MAINTAINER Mark Shust <mark@shust.com>

ADD . /opt/app
WORKDIR /opt/app/programs/server

RUN npm install \
  && mv /opt/app/programs/server/node_modules /opt/

RUN mv /opt/app/package.json /opt

WORKDIR /opt
RUN npm install

RUN ln -s node_modules app/programs/server/node_modules \
  && ln -s node_modules app/programs/web.browser/node_modules \
  && ln -s node_modules app/programs/web.cordova/node_modules

WORKDIR /opt/app

ENV PORT 80
EXPOSE 80

CMD ["node", "main.js"]
ndarilek commented 8 years ago

Is this still working for you with beta11? I just attempted something similar and, while the server starts, the client fails to find the react module. Here's my Dockerfile, pasting here since it might help to agree on what this image might eventually do. I'm a bit disappointed that meteor build doesn't run npm install on package.json since we're now encouraged to use React from NPM:

FROM node:0.10.41
ENV PORT 3000
EXPOSE 3000
RUN adduser --system --no-create-home --disabled-login app
COPY . /src
RUN curl https://install.meteor.com |sh && \
  cd /src && \
  meteor build --directory / && \
  rm -rf /usr/local/bin/meteor /root/.meteor
RUN cd /bundle/programs/server && \
  npm install && \
  mv node_modules /bundle && \
  cp /src/package.json /bundle && \
  cd /bundle && \
  npm install && \
  ln -s /bundle/node_modules /bundle/programs/server && \
  ln -s /bundle/node_modules /bundle/programs/web.browser && \
  rm -rf /src
USER app
WORKDIR /bundle
CMD node main.js
krstffr commented 8 years ago

Any news on 1.3 support?

Maybe you're waiting for the proper (non-beta) 1.3 release before making a working version?

Thanks

fermuch commented 8 years ago

just a note for anyone coming here wanting to deploy with docker && meteor 1.3:

I solved it by using this tutorial.

markshust commented 8 years ago

@fermuch thanks for the shoutout :) needed something working until meteord is all set. my docker image seems to work really well & builds fast. note that the 'slim' node isn't wasn't working with the newer beta updates, you need to build from the standard node image.

clayne11 commented 8 years ago

Looks like Meteor 1.3 requires node v0.10.43. When are you guys planning to get the update out?

arunoda commented 8 years ago

@clayne11 I think it's here by now. (assume Docker Hub completed the building)

sathishc commented 8 years ago

Does this work now with Meteor 1.3?

gbhrdt commented 8 years ago

If anyone is interested in an 1.3 compatible version, you can try mine: gbhrdt:base and for binary building gbhrdt:binbuild (you might want to include REBUILD_NPM_MODULES environment variable for the second one).

MPJHorner commented 8 years ago

Simple fix. In your Dockerfile just copy the package.json and npm install it.

FROM meteorhacks/meteord:base
COPY src/app/package.json /bundle/package.json
COPY build /bundle
WORKDIR /bundle
RUN (npm install)

I'm also copying the tar file for meteord to use here, but all should apply works as you like.