Open Wirone opened 4 years ago
@sampaiodiego @rodrigok could you look at this? Is it something you consider?
hi @Wirone we have tried to this already a few times without success..
we're definitely accepting contributions on this matter.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@sampaiodiego if you point me where I can find requirements (Node, NPM versions, other dependencies) for running RocketChat, I could try it, but I can't promise anything π
This is a script I use to build a production docker container:
version=$(meteor npm version | grep 'Rocket.Chat' | egrep -o '[0-9]+.[0-9]+.[0-9]+')
ref=$(git rev-parse --short HEAD)
meteor npm install
meteor build --server-only --directory /tmp/build-pr
cd /tmp/build-pr
cp /home/maarten/projects/github/rocketchat/.docker/Dockerfile .
sudo docker build -t <docker_repo_url>:$version-$ref .
meteor npm install
is the command that makes sure all the dependencies are installed. You'll need to install Meteor for it to work of course. The README mentions using meteor npm start
instead of meteor build
to run the dev environment.
I have successfully used this Dockerfile to have a running container able to build rocket.chat, but as you can see it clones Rocket.Chat repo to the image, changing this to reading from the host's filesystem might do the trick:
FROM node:12.16.1
VOLUME /tmp/rc-build
# ENV NODE_VERSION 12.16.1
# ENV NODE_ENV production
# OS environment
RUN set -ex \
&& apt update \
&& apt-get install -y build-essential python3.5-dev vim \
&& groupadd -g 65533 -r rocketchat \
&& useradd -u 65533 -r -g rocketchat rocketchat \
&& command -v meteor >/dev/null 2>&1 || curl https://install.meteor.com | sed s/--progress-bar/-sL/g | /bin/sh \
&& mkdir /app \
&& chown rocketchat:rocketchat /app
# User environment
USER rocketchat
ENV HOME /app
WORKDIR /app
RUN export PATH=$HOME/.local/bin:$PATH \
&& curl -O https://bootstrap.pypa.io/get-pip.py \
&& python3.5 get-pip.py --user \
&& pip install awscli --upgrade --user
RUN set -ex \
&& git clone https://github.com/RocketChat/Rocket.Chat.git
# && cd Rocket.Chat \
# && meteor --version \
# && meteor npm i
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Unfortunately I don't use RocketChat anymore since I've changed company that I'm working with, but personally I think this is basic functionality for contributors, who would like to work with RocketChat, but don't want install all the requirements on their computer. Such setup would also make development consistent between all people (Node version etc.). Please consider giving it higher priority, @sampaiodiego :wink:
As somebody who contributed (once) I wholeheartedly agree wit Wirone that a docker-based setup would make life a lot easier for contributors!
Especially considering that there are pre-push git hooks that can lead to pretty serous headaches (or at least there were when I tried)
very sad for this unresolved issue... anyone else work on this ?or is there another solution?
As an alternative, maybe you can use approach similar to Gitlab and provide some SDK that will ease development (installing and running everything that is needed to work with the app)? Not necessarily as complex as GDK, but covering basic environment... Maybe use asdf
and provide .tool-versions
so it will work exactly the same way on every developer's computer?
Just thinking out loud π
I used to have a setup using the official Docker-Compose and a modified Dockerfile that just needed a npm run ...
to start a "dev" RocketChat, but it's been a while and I can't find it / make it again with the changes done (file structure changed, docker related files too, and you're "forced" to use yarn
)
Here is what I used recently (clone https://github.com/RocketChat/Rocket.Chat and then add these two files βοΈ )
Find the meteor
version required with cat apps/meteor/.meteor/release
Create a Dockerfile
, that use the found version in FROM geoffreybooth/meteor-base:VERSION
# Use an image with meteor already there, as meteor installation can be loading for a while (sometimes forever)
FROM geoffreybooth/meteor-base:2.5.6
RUN apt-get update && apt-get dist-upgrade -y RUN apt-get install -y build-essential git curl python3-minimal pkg-config
WORKDIR /usr/src/app/apps/meteor
RUN meteor npm install --global yarn
CMD "meteor yarn dev"
3. Create a `Docker-Compose` by copying [RocketChat/Docker.Official.Image](https://github.com/RocketChat/Docker.Official.Image/blob/master/compose.yml) and making slight modifications to use our Dockerfile
services: rocketchat:
build:
dockerfile: Dockerfile
context: .
# command: >
# bash -c
# "for i in `seq 1 30`; do
# node main.js &&
# s=$$? && break || s=$$?;
# echo \"Tried $$i times. Waiting 5 secs...\";
# sleep 5;
# done; (exit $$s)"
volumes:
# Map the whole app files (to avoid a COPY/ADD in Dockerfile)
- ./:/usr/src/app
[...]
Hope that will help some of you guys ! It's always frustrating to be blocked by dev env when you want to contribute π
Current development workflow is described in
README.md
as:with Git and Meteor as prerequisites.
It does not make sense in modern app development to pollute local machine with dev dependencies (Meteor and NPM packages) and also does not ensure that app is run on the same environment.
Unfortunately
docker-compose.yml
does not offer local stack based on local code sincerocketchat
service is run fromrocketchat/rocket.chat:latest
.Would be great if there was local development process based on Docker stack, with RocketChat service built from local files, so developer could easily do
docker-compose up -d
and start the app and work on the code (changes should automatically restart server).Worth considering:
traefik.frontend.rule=Host:${ROCKETCHAT_HOST:-rocketchat.local}
)DOMAIN_NAME: "default:${ROCKETCHAT_HOST:-rocketchat.local}"
) (fork because this PR wasn't merged but it's much better to define developer-friendly host rather than default, convention-based hosts)node_modules
would be stored outside of container and can be easily re-used and changes in code would have immediately effect in the running container.dockerignore
, such as CI configsMakefile
with helpful jobs for running app and tests locally