Meteor Git Repo and symlinks


#1

Hello everyone,

I am looking for someone who has experience working in a meteor dev team with different environments.
I have a project with two meteor apps that share the some custom packages. The repo structure is kind of like this:

/
   /packages
   /adminApp
   /mobileApp

and I created symlinks in the adminApp/packages folder that point to the /packages folder.

I read the git support for windows thread with @dandv pushing for support of symlinks on windows but I don’t understand the applied fix. The symlinks on windows appear as files but meteor is not able to find the packages.

How can I have this type of repo that can be cloned in windows ? Or what are the workarounds possible ?


#2

One solution could be to ignore the symlinks the app/packages folders and to run a script after each pull to create them using ln -s or mklink depending on the platform.

What do you think about that ? Could there be an easier approach ?


#3

I thought there was a way to define a global package directory, but I can’t find it in the docs at the moment. Maybe it was for an old version of Meteor.


#4

Oh yeah! There seems to be a PACKAGES_DIR environment variable as stated here http://stackoverflow.com/a/28070364/4265107

Maybe @serkandurusoy has some input on this ?


#5

PACKAGES_DIR is a list of directories in which to look for packages. Directories are delimited by the appropriate separator character (: in linux, ; in windows).

Local package directories are searched first when building an app.

For example (linux):

export PACKAGE_DIRS=/path/to/directory:/different/directory

#6

Yep, exactly as @robfallows has explained. You’ll of course need to set up your environment variables at

computer properties > advanced system properties > environment variables

or use the set command on the command prompt like:

C:\> set PACKAGE_DIRS="C:\pathtoyourprojectgrouproot\packages;C:\somegloballyavailablelocalmeteorpackages\"
C:\> meteor

#7

Thanks a lot to you both! I think this is the most simple solution for this problem.

It would be nice that some blogger with a lot readers would a little article on this so that future people in my position would find a solution easily. Or maybe even better: create an “environment variables” section in the docs that list all of the variables used by meteor.


#8

These are all the process.env.XXXX I grep’d out of the current codebase (E&OE):

ANDROID_SDK_HOME
APP_ID
AUTOUPDATE_VERSION
BIND_IP
CONSTRAINT_SOLVER_BENCHMARK
DDP_DEFAULT_CONNECTION_URL
DEPLOY_HOSTNAME
DISABLE_WEBSOCKETS
DISCOVERY_PORT
EMACS
HOME
http_proxy
https_proxy
MAIL_URL
METEOR_APP_PRELINK_CACHE_SIZE
METEOR_AVD
METEOR_BAD_PARENT_PID_FOR_TEST
METEOR_BUILD_FARM_URL
METEOR_CATALOG_COMPRESS_RPCS
METEOR_COLOR
METEOR_DEBUG_BUILD
METEOR_DEBUG_SPRINGBOARD
METEOR_DEBUG_SQL
METEOR_DISABLE_BUILDER_IN_PLACE
METEOR_INSTALLATION
METEOR_LINKER_CACHE_SIZE
METEOR_LOG
METEOR_NO_WORDWRAP
METEOR_OFFLINE_CATALOG
METEOR_OPLOG_TOO_FAR_BEHIND
METEOR_PACKAGE_SERVER_URL
METEOR_PACKAGE_STATS_SERVER_URL
METEOR_PACKAGE_STATS_TEST_OUTPUT
METEOR_PARENT_PID
METEOR_PKG_SPIDERABLE_PHANTOMJS_ARGS
METEOR_PRETTY_OUTPUT
METEOR_PRINT_ON_LISTEN
METEOR_PROGRESS_DEBUG
METEOR_SAVE_TMPDIRS
METEOR_SESSION_FILE
METEOR_SETTINGS
METEOR_SHELL_DIR
METEOR_TEST_FAIL_RELEASE_DOWNLOAD
METEOR_TEST_FAKE_MONGOD_CONTROL_PORT
METEOR_TEST_LATEST_RELEASE
METEOR_TEST_MULTIPLE_MONGOD_REPLSET
METEOR_TEST_NO_PUBLISH
METEOR_TEST_PRINT_LINKER_CACHE_DEBUG
METEOR_TEST_TMP
METEOR_TOOL_PATH
METEOR_WAREHOUSE_DIR
METEOR_WATCH_FORCE_POLLING
METEOR_WATCH_POLLING_INTERVAL_MS
MOBILE_DDP_URL
MOBILE_ROOT_URL
MONGO_OPLOG_URL
MONGO_URL
NODE_DEBUG
NODE_ENV
NODE_OPTIONS
NO_METEOR_PACKAGE
PACKAGE_DIRS
PORT
ROOT_URL
RUN_ONCE_OUTCOME
SERVER_WEBSOCKET_COMPRESSION
SystemDrive
THROW_FROM_PACKAGE
TIMEOUT_SCALE_FACTOR
TINYTEST_FILTER
TREE_HASH_DEBUG
USE_GLOBAL_ADK
USE_JSESSIONID
WRITE_RUNNER_JS

#9

https://dweldon.silvrback.com/local-packages and http://themeteorchef.com/recipes/writing-a-package/#tmc-local-packages discuss that, and these guys are pretty popular with their blog posts and tutorials.

Although I admit I don’t enjoy their material as much as I do funny kittens :wink: just kidding of course, they are indeed two great meteor resources :smile:


#10

@robfallows now you have to write a blog post explaining all of these. You just cannot leave it hanging in the air like that :smile:


#11

Missed this…

Alright then I’ll do my research more thoroughly next time no need to take the piss (even thought it’s well deserved).


#12

LOL.

I can explain the grep.

I can even explain some of the env variables…

… but I was kinda hoping someone else might like to jump in :smile:


#13

On the same topic. I’ve got the same structure as @elgusto and haven’t quite figured out the workflow for making git commits that pull in package contents. I just end up committing the symlinks.

Does anyone know of a step by step tutorial for getting this working? I’m using a Mac.


#14

@babrahams @elgusto what I do when I need to dissect an app into shared local packages, is to make my git root the topmost folder containing apps and packages

/project
/project/global-packages
/project/web-app
/project/mobile-app
/project/admin-panel
/project/misc

and use PACKAGE_DIRS to point at /project/global-packages

Since I commit the project directory, I can easily track and share the changes to everything.

I use the misc directory for some docs, configuration files that are not security-sensitive etc.


Sharing code between multiple apps with shared database
Monolith vs. Multiple apps, an architecture question
#15

@serkandurusoy - Legit. Thank you so much.

By the way, I should have said this a long time ago … Every time I see a post of yours on these forums, I read it with interest. For me, you’re the voice of reason when things get heated, and a constant source of useful knowledge for all of us. Major respect.


#16

Wow, I really don’t know what to say! Thank you @babrahams this means a lot! :smile:


#17

Was it this thread?

Make sure to install the right git for Windows. The release from July 18 claims to handle symlinks on Windows.


#18

@dandv Yes this is the one! It got pretty heated in the end…

Thank you for the heads up converning the right version!


#19

Hi, are you using this with galaxy deploy? I don’t know if this will work. Will deploy command understand package_dirs and upload these folders inside my app or your packages are published in atmosphere?


#20

Yes it will understand that because deploy is basically a “build and upload”.