简体   繁体   中英

rails application with database in different server rake task

I have a rails application. running in two server. The application server and the database in another server. Daily i must process some csv files that I receive. I do the processing, using the rails environment, located in the application server and the information is saved in the database, in the database server. It would make more sense to me, to send the csv files to the database server and do the processing there, but I would still want to use Rails environment to build all associations, geoprocessing and etc. Also, I could just copy my application as well to the db server, don't start it but use it to process my CSVs files. Despite the fact that it works, it doesn't sound to me something easy to maintain (ie always deploy in two different servers the same application). Anybody has an idea or pattern that I could use here?

It'd be just as easy to manage deploys to those two server as long as you'd use a deployment tool like capistrano . With capistrano you can easily customize what you do on each server, eg you could deploy to both servers at once, restart web server on the application server while running tasks only on your database server.

For managing crontab tasks you can use whenever gem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM