Cannot find module "mysql" while running on heroku - mysql

I have been trying to deploy my app on heroku.
I first used the command git push heroku master
and then running the node server using heroku run node server.js
However I get this error. Can anyone help me with this?
enter image description here

I've run into this error before using ibm db2... what you have to do is make a new directory locally, and login to Heroku using git in that new directory. once you do that, copy each folder and file into your new directory from your old one, (you can cp ../olddirectory/app.js,etc, etc)including the package.json and package-lock.json. once you do all that, push it, and it should work.
This sounds so stupid, but it works. every. freaken. time. I do this with all my projects as they all use db2. let me know if you need any more help.

Related

app.config inside .ebextensions is not getting updated with `eb deploy`

I'm using eb deploy from the command line to deploy changes to my Elastic Beanstalk environment (a Flask app). However, when I make changes to my app.config file (which contains container_commands), and then run eb deploy, the post commit commands being run are from the old app.config file, and never seem to update.
When I examine the zip file actually submitted to AWS, it reflects my app.config changes.
Any ideas on what might be going wrong here? I have verified that I am pushing changes to my git branch before attempting eb deploy.
Thank you!

Clone Openshift application in scalable

I have an application in Openshift free plan with only one gear. I want to change it to scalabe and take usage of all of 3 free gears.
I read this blog post from openshift and I found that there is a way to do it. I should clone my current application to a new one as a scalable which will use the 2 remaining gears and then I will delete the original application. Thus, the new one will have 3 free gears.
The way that blog suggest is: rhc create-app <clone> --from-app <existing> --scaling
I have the following error: invalid option --from-app
Update
After running the command gem update rhc, I don't have the error above but...A new application with the given name has created with the same starting package (Python 2.7) just like the existing one, but all the files are missing. It actually create a blank application and not a clone of the existing.
Update 2
Here is the structure of the folder:
-.git
-.openshift
-wsgi
---static
---views
---application
---main.py
-requirements.txt
-setup.py
From what we've talked on IRC, your problem was around missing SSH configuration on Windows machine:
Creating application xxx ... done
Waiting for your DNS name to be available ...done
Setting deployment configuration ... done
No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.
I've double checked it, and it appears to be working without any problem.
The only requirement is to have the latest rhc client and putty or any other
SSH client. I'd recommend going through this tutorial once again and double-check everything to make sure everything is working properly.
Make sure you are using the newest version of the rhc gem with "gem update rhc" to make sure that you have access to that feature from the command line.
The --from-app will essentially do a 'rhc snapshot save & snapshot restore` (amoung other things) as you can see here from the source:
if from_app
say "Setting deployment configuration ... "
rest_app.configure({:auto_deploy => from_app.auto_deploy, :keep_deployments => from_app.keep_deployments , :deployment_branch => from_app.deployment_branch, :deployment_type => from_app.deployment_type})
success 'done'
snapshot_filename = temporary_snapshot_filename(from_app.name)
save_snapshot(from_app, snapshot_filename)
restore_snapshot(rest_app, snapshot_filename)
File.delete(snapshot_filename) if File.exist?(snapshot_filename)
paragraph { warn "The application '#{from_app.name}' has aliases set which were not copied. Please configure the aliases of your new application manually." } unless from_app.aliases.empty?
end
However this will not copy over anything in your $OPENSHIFT_DATA_DIR directory so if you're storing files there, you'll need to copy them over manually.

Openshift Cronjob Not Running

I have tried to setup a simple cron job running on openshift but once I have pushed the file to openshift and then login and search for the file it does not seem to be there and there is not log output.
I created an application from: https://github.com/smarterclayton/openshift-go-cart
I then installed the cron 1.4 cartridge.
I created a file at .openshift/cron/minutely/awesome_job and set it as 755
I added the following contents:
#! /bin/bash
date > $OPENSHIFT_LOG_DIR/last_date_cron_ran
I pushed to the server
Logged in via ssh and run find /var/lib/openshift/53760892e0b8cdb5e9000b22 -name awesome_job for which it finds nothing.
Any ideas which might help as I am at loss why is it not working.
Make sure the execution bit is set on your cron file.
The issue was not with cron but with the golang cartridge I was using which was removing the .openshift directory.
https://github.com/smarterclayton/openshift-go-cart/issues/10
You should also put a file named "jobs.allow" under your .openshift/cron/minutely/. So your cron jobs will be executed.
For your ref: https://forums.openshift.com/daily-cron-jobs-not-getting-triggered-automatically
And the reason you can find your awesome_job vis ssh login is because it is under /var/lib/openshift/53760892e0b8cdb5e9000b22/app-root/runtime/repo/.openshift, so the command find does not search any files under folders named with . prefixed.

"hg" directory location on Hostgator Mercurial Installation

I am following the directions here trying to get Mercurial running on my shared HostGator account.
I am supposed to create a "hg" directory, but I am unsure if it is to be in the /home/user/ location or in /home/user/domain-I-want-to-version-control/. I actually tried creating that directory, and the modified 'index.cgi' inside. When I then navigate to (url)/hg I get an internal server error.
Could really use some guidance, please.
Never create repository this way! If you want to add Mercurial repo for existing code (did you try to verify, that you have working hg?!) read before it QuickStart Guide at least

Mercurial clone operation works, but I don't have write access

Somewhere I did something silly.
I was deploying my Rails app via cloning the Mercurial repo down onto my Ubuntu server. It worked the first time, and then...well, I made a small change on my dev machine, pushed the changes to the repo, and then deleted the copy on the Ubuntu server and re-cloned from the repo.
The clone operation (the second, and third, and 'n' times) works without error, but I don't have write access to the files that were cloned.
When I try to startup my mongrel - it can't create the /tmp folder, and because of no write access, fails to start the Rails app.
Fixed through work around stated in comment above.