I am hitting a problem where I need from time to time to write jobs to change datas on my MongoDB.
Currently I need to redeploy on galaxy after testing the code locally.
I am looking for a way to have a separate instances where I can simply deploy my meteor app without annoying my users so that I can have my new jobs run immediately.
I am using wildhart/meteor.jobs ro run jobs so maybe I can set the serverId of the queue to be the one of the server I will be deploying.
I am pretty sure that everyone have this problem ( writing codes for chore purposes ) but I do not find any good solutions
Nosqlbooster has some scripting ability - you can basically write js code which manipulates your data without the need for deployment overhead. You can develop your script against a copy of your database
We also started doing something similar to @rjdavid recently. We had tried various other queues in the past but Bull is the one that feels really well thought out and is in active development. Bullboard is also nice for keeping tabs on them.
We kept a single app and then assign roles like webapp or jobs to different instances. Ideally we’d have separate apps which could be launched in parallel with rollbacks if any of them fail - but we run on elastic beanstalk and the options for orchestration are limited.
With the updates to Monti planned to automatically instrument job queues this should become even nicer.
Set up a separate staging environment on Galaxy could help - you can test job changes there before deploying to production. The wildhart/meteor.jobs package should let you use a different server ID for the staging queue
I use webapp to handle jobs, then I setup cronjob on a private machine which calls the api. By using this setup, I don’t have to deal with “serverId” issue.
We have split our app into 2 parts, one is the client facing app, and the second is an admin app. There are 2 meteor instances which share the same DB. This gives us the ability to modify and deploy the admin app independently of the client facing app. This could be what you need?
Yes, but not that easy to do because it required to at least have collections in private package to be consumed inside both app.
I am trying to find a way to do it with same codebase and to tell GitHub - wildhart/meteor.jobs: A simple job scheduler for Meteor.js to consume jobs only on a certain server based on env variable for example or meteor settings.
You can search for an Instance by name, get its Id and compare with your running instance id.
const targetInstance = (await Instances.findOneAsync({ slug: whoShouldRunTheJobs }))?._id
const thisInstanceId = InstanceStatus.id()
if (targetInstance === thisInstanceId) {
// go ahead, run the jobs.
}
You can create a logic in your instance name generation for instance with sequence numbers such as server1, server2, server3 etc and run specific jobs with specific names with the same codebase.