Git hosting with meteorjs


#1

Hey everyone, thanks for any help you can provide.

I would like to develop a web app and would like to choose MeteorJS to create it, however there is an issue which I think is blocking me.

A few notes:

  • I want to use git internally, I.e to host bare git repositories as remotes for users
  • MeteorJS erases and adds to it’s file system every deploy
  • There seems to be only one file system package cfs:filesystem but it doesn’t seem useful to me
  • My job is a programmer for desktop\installations and so I may be approaching this problem wrong

Now for the questions

  1. How would you use git in your meteorjs project (I.e make use of the git executable) as a remote?
  2. Is it safe\possible to write to \ read from outside of the deployed project when on a host?
  3. Is meteorjs just not meant for my type of project?

Please let me know if you need more info.


#2

microservices; if you build a process (either a script or binary, whatever) that handles the git aspects and communicates over a common message bus, such as MQTT, you can use meteor server methods to issue commands to it and get results back (over that bus). its actually not too hard to do and packages like slava’s amazing redis integration would make it not only a snap, but easy to incorporate into the ui. i used a similar method for iot device on-line status at one point (redis expiry messages are awesome)


#3

Forgive me if I seem like a beginner. But where would this binary live and place it’s actual file structure? Would I have to have multiple servers to do this (one for my web app and one for my git server)? Is there really no way that I can reliably play with the meteor\node file system directly (I.e through nodejs ‘fs’ and ‘exec’)?

Again I am not sure how redis will help but I am most probably missing something, from looking at the package you mention (https://atmospherejs.com/slava/redis-livedata). It looks like a way to store data structures rather than an actual group of files and directories (Which is what a git init --bare looks like) and doesn’t require syncing with the client as I would hopefully be giving them a link like git://username/projectname.git that would they can pull\push too as normal.

Would something like this: https://github.com/nodegit/nodegit node package work with meteor? Or am I still missing something important?

Thanks for your input so far! I really appreciate it.


#4

The git binary would live on the server. You would create a simple script that issues commands to the git binary. The script would get those commands from data structures stored in Redis. Meteor would write those command structures to Redis. In this way you are using Meteor as a UI/frontend to service that in the end calls git. Redis becomes the communication pipe.

So, more or less github is doing from what I understand (git+scripts+a web thing)

I skimmed the nodegit readme and I can’t see why you couldn’t use this.

I am just not getting back into Meteor after a break (v9 or so), but when I last tried to shoehorn backend services into the ‘server’ part of my Meteor project it created more headaches than it was worth for me. Just my experience though.


#5

Okay, thanks for the detailed response. I will try it out.

Still have a few questions:

  • Why use a ‘communication pipe’ for running a binary? Is this just for separation of concerns?
  • Do metoerjs hosts usually let you write outside of the deployed project directory? Or is this why you need to use Redis as a intermediary between the server and the git binary?
  • What exactly is\should be running the scripts on the ‘other’ side, a nodejs instance or cronjob or something else?

#6
  1. You dont need communication pipe. As you mentioned, you could use any node-git library (Meteor is node one!) and no matter whats about binaries.
  2. It’s node again. Just use fs
  3. Everything you wish. It could be simple script or node-cron, whatever

#7

Thanks for the reply!

Yeah I know I don’t need one but I was wondering why he suggested to use it.

The problem is I don’t know if meteor hosts like it if you write to things outside of the project directory. Here is another way to write that question: Is it expected or okay that a meteor web app might write to ~/ \ home directory?


#8

Why not? You could write anywhere you wish (but make shure about access, next guess running under root):

import path from 'path';
import fs from 'fs';
import request from 'request';

const fileToSave = path.join(__dirname, '../..', Meteor.settings.files, 'logo.png');
request('<some url>').pipe(fs.createWriteStream(fileToSave));

#9

I’m worried that using meteorjs in non-standard ways may become unsupported or even not allowed with from either meteorjs itself or hosts I.e Is Galaxy\etc okay with doing that? Will meteorjs eventually disable writing outside of the project directory for security?

Regardless just for other peoples info I found another node package that might be helpful for git hosting, if anyone has comments or anything about it that might be helpful please join the conversation:


#10

Dont worry it works fine (as pure node application) out from the box. I havent sn any restrictions about that.