Hi, I have a team working on several apps. Mainly Meteor and React Native, etc. We faced several issues while working:
- Let’s say I have my app setup in my office machine. I went home and tried to complete some work. Tried to setup the environment and things failed. Sometimes
- I went home and noticed that I have to get a dump of the database on my office machine to get started.
- When I come back, I have to re-sync the db.
- Basically, setting up the development environment takes time.
How can I solve these problems? Please note that we also use react native. Running the emulator takes a lot of resources so adding Vagrant might slow things down even more. Please help. How do you work?
Cloud9 private ssh workspace for meteor app dev; React Native local dev.
In a case like this, you could use the same database remotely if your meteor app is running on a linux server.
Like in this: https://github.com/spencercarli/react-native-meteor-boilerplate/blob/cadf7440d45d5340649acd770ed746a81ea7be33/RNApp/app/config/settings.js
But you can change localhost to an ip or url for your database running on the linux server, and can secure by restricting data retrieval by ip or user auth.
let METEOR_URL = 'ws://yourdomainhere.com:3000/websocket';
You could try docker for an alternative with less overhead. Regarding the database, you could also setup a test database for you on something like mlab and point your development version to that so you’re working on the same database when you get home. I prefer to just work with a local database though to be able to inspect easier and haven’t had many problems using migrations and scripts to dump and import the database occasionally.
Nowadays, I use a completely mocked-up db for dev, that gets reset and reseeded at each startup:
- I start meteor with:
meteor test --full-app --driver-package tmeasday:acceptance-test-driver. This creates a brand new, throw-away dB every time. You can connect to it in the shell with
mongo meteor --port 3001
- Each larger subsection of the meteor-app is responsible for seeding its own docs. So
/imports/users/server/userSeed.js creates an admin user, a normal user and a zerorights user. And
/imports/todos/server/todoSeed.js creates some fixed todos. And so on.
- It doesn’t matter if I work on my laptop or desktop, I know I’ve got the same set of data to play with. Sync of code is over git repo.
- Added bonus: it helps a lot for e2e testing with something like chimp to have consistent data: you know that as a normal user, there should be 5 todo’s, and the second todo should be ‘Get the milk’
- For react-native, I get my data from the same mongo-db as meteor over graphql. So I have the same exact data in RN ( as long as I remember to startup meteor in the background first for seeding).
Great thanks. I think writing some good seeds will help a lot!