Automated Heroku Database Backups to Amazon S3 - cron

how to create rake task for
heroku pgbackups:capture --expire
and call this task to the cron job

try this https://github.com/joemsak/heroku_backup_task

Related

How to deploy my Node server to ec2 using Jenkins?

I have probably been Googling this the wrong way...
I have a Node express server.
I want to deploy it using Jenkins to ec2.
What are my options?
if I want to upload the code manually, I use ssh... but I want it to
be done from Jenkins.
Yes the server is on a git repo.
I would like a devops flow
I recommend you , to do it step by step :
Step 1 : Configure correctly a jenkins job ready to build your app in remote ec2 machine.
Install this plugin in your jenkins platform : Publish Over SSH Plugin
Using this plugin add new remote server under Publish over SSH section in Manage Jenkins >> Configure System option.
Now create some jenkins job. Then, in build section add a step called : Send files or execute commands over SSH
Just select your configured server and enter your commands in Exec command section :
For a simple node js express, this code could be enough or just copy-paste your existing code:
https://gist.github.com/jrichardsz/38b335f6a5dc8c67a386fd5fb3c6200e
That is all. Just test with "build" option and verify if your application goes well.
At this point, this job is functional. The flow could be :
push your changes to your git provider
login to jenkins and manually execute the created job (this step is replaced with webhook configuration)
Note: If and only if this step has no errors, you can start with the following step.
Step 2 : Implement a simple devops flow by configuring a webhook in your git provider, which automatically triggers the jenkins job (create in step 1) when you perform a git push.
This guide could be help you with the required configurations :
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
You'll have to use AWS CodeDeploy jenkins plugin. This apply to any type of code. Node, java etc
See AWS article
Setting Up the Jenkins Plugin for AWS CodeDeploy
Jenkins Plugin
Github Link

Cron Jobs - Azure Azcopy ini files

We have Azure Azcopy configured on Ubuntu Server (16.04). The ini file we have created pulls data from a cloud storage account to the local Ubuntu system. When we run it manually, there are no issues.
However, we want to run it via a cron job every thirty minutes.
Here are the steps we have taken (we've tried variants from stack flow postings as well). Cron is running.
crontab -e
30 * * * * root /azcopy/azcopy --config-file "azcopy_run.ini"
crontab -l lists it fine
no errors in logging
Any guidance please?
Thanks

How to create cron jobs on Hasura?

How can I create, deploy and run and manage Cron jobs on Hasura?
Hasura suggests two ways to deploy and run Cron jobs.
Cron microservice
Hasura already has a microservice to run Cron jobs.
If you already have a Hasura project run:
hasura microservice create mycron --template=python-cron
Change mycron to whatever you want to name your microservice. This will create a custom Python microservice designed to run Cron jobs. (Follow further instructions as prompted by hasura CLI)
To deploy this on Hasura, git commit and push to your cluster's remote.
$ git add .
$ git commit -m "Add cron job"
$ git push hasura master
To know more about how to customize this microservice, you can read the docs.
Kubernetes Cron jobs
Since, Hasura runs on Kubernetes and Kubernetes (>= v1.8) already provides Cron Jobs as a first class resource, it is recommended to use Kubernetes Cron jobs wherever possible.
If you have kubectl installed you can check your Kubernetes version by running: kubectl version. In the output, the "server version" shows the version of the Kubernetes cluster. If you are running Kubernetes >= v1.8, we recommend you to use Kubernetes Cron jobs.
When using Kubernetes Cron jobs, you can version control your cron job specs inside your Hasura project, and use the kubectl tool to create and manage them.
The upcoming Hasura Release 1.3 will support "cron triggers". The beta is already released

How do I enable continuous deployment of Node.js applications to Amazon EC2?

I am a node.js developer. I have used Heroku and Joyent's no.de platform before .
For both of these platforms , the deployment used to be simple
git push heroku master ( Heroku )
git push joyent master ( Joyent's node)
The above commands used to do the magic . They enabled me to push the code from my local machine to the cloud server, deploy it and automatically restart the server .
Now I am planning to use Amazon AWS as its more configurable to my needs. How do I setup a similar thing on Amazon EC2 for continuos deployment ?
I am using an Ubuntu AMI.
Is there any tool that help me achieve this ?
If there are any resources/tutorials that might help me - please let me know.
Thanks !
That auto-deploy mechanism is implemented with Git Hooks. The most likely hook used is post-update.
It's a simple bash script that is executed on a git push; put one in a git repository on your EC2 server including the code to re-run NPM (if needed) and restart your code.
That's should do it. :)
Use roco - deployment solution inspired by capistrano, working great with express/railwayjs + git + upstart. If you have another env feel free to customize it using Roco.coffee
It also can be simply configured with post-update hook to work exacty as in heroku and joyent.
Here is tiny tutorial for this tool: http://node-js.ru/4-deploy-with-roco
Check out AWS Elastic Beanstalk
It lets you deploy your application to an amazon ec2 instance by running:
git aws.push --environment testing
// or
git aws.push --environment production
The documentation page contains a lot of quality information to get your started!

Heroku Cron: How to find the cron schedule?

If I log into the Heroku site and view my Cron add-on, Heroku will show me:
the next time cron is scheduled to run, and
the last time cron ran.
Is there a way to query this info via heroku CLI (or cleanly obtain this via some other way programatically?)
Thx.
heroku info via cli will give you the last run and next run time

Resources