I have deployed a Sails api to Heroku I had been using the localdiskdb for quite a while without any issues. I have recently spun up a JawsDB instance to connect with the api.
jawsDB:{
adapter: 'sails-mysql',
url: process.env.JAWSDB_URL,
schema: true
},
I have set the model in production.js to jawsDB.
We have been using a local mysql instance with no issues in development
I also have tested it on a Amazon RDS instance that I connected to locally
I have tried all the connection strings that JawsDB provides
I have tested different arguments in the sails adapter, including ssl: true
I have swapped out jawsDB for localdiskdb in the production.js file to test if it was even hitting it and it worked with no issues
I have Papertrail set up and get no errors or any strange log entries of any kind when lifting sails
I have been at this for the better part of a few days. At this point I really think I am missing something rather dumb. If anyone has any experience with setting this up the help would be greatly appreciated.
Turns out I am dumb! I didn't have enough error logging to notice my application quickly used more than the 10 available connections that JawsDB offers for their free account.
My solution, use Amazon RDS.
Related
I have a Spring Boot application which is deployed to Heroku. I've been using ClearDB ignite for some time and everything worked perfectly, but today I upgraded ClearDB addon to punch(paid), because I needed more capacity and now when I open my app it seems that it's unable to connect to a db and logs prove this.
So I imported my local mysql file into cleardb, and I can see all my tables in there when I connect to it through command line. Basically I did all the same steps as when I was using ignite.
But what's interesting, when I was using ignite, and executed heroku run env command, all variables such as SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD were already set in env variables list, so I didn't have to specify them in my application.properties file.
Now when I run this command, only CLEARDB_DATABASE_URL is there. I tried to set them inside properties file.
(I modified username and password on purpose now for screenshot)
I also tried setting these using DataSourceBuilder but nothing seems to work.
Anyone has any ideas what it might be?
Thanks in advance
Resolved by creating new heroku app and only adding ClearDB punch addon, imported local db and everything works. Looks like when I added a new cleardb addon while still using free one mixed up some config settings, I don't have any other explanation. Anyways, problem solved.
I have made a MySQL database on my local server.
I want to port this to Heroku. Would there be any way to do this without using ClearDB? ClearDB asks for account verification, credit card details etc. which I do not want to give. The rest of the application is hosted on Heroku, so I just need to migrate the database.
Would this be possible?
You have at least three options:
There are other Heroku addons that provide MySQL databases. I'm not sure if any of them let you get started without a credit card.
You could use a MySQL provider that's not explicitly supported by Heroku and point your application to it manually.
You could update your application to use PostgreSQL instead of MySQL and use Heroku's own Postgres service.
I have my Sails application on an AWS instance with all dependancies installed with no apparent issues. However, each time I try to launch the app I am getting the following error.
error: AdapterError: Connection is already registered
I have not managed to successfully lift sails yet on the instance and sails-mysql was freshly installed so no connections should be registered.
I have taken the following steps to deploy my app..
Set up a MySql RDS instance (EU-West)
Created and set up an Ubuntu AMD-64 t2.micro EC2 instance (EU-West)
Installed all prerequisites (Git, NVM, NodeJs, Sails, etc.)
Cloned my Sails project
Installed dependencies for Sails
Correctly configured my connection settings for Sails to use my RDS instance.
I know that my connection settings are correct as I have been able to run Sails on my local machine with a connection to my RDS instance and it would consistently lift without any issues.
I am also able to connect to my RDS instance using SequelPro with no problems.
I have had issues with dependencies in the past but have managed to fix those issues and have not had any of them on my local machine or with my EC2 instance.
After searching for a while I have come across a few users who have had similar issues but have managed to fix them with Waterline's teardown methods, however, I am unsure how to achieve this.
I have done my best to provide as much information as possible and any help would be massively appreciated.
Sails Version: 0.12.11
Thank you in advance.
I managed to fix the issue by carrying out the following:
Switched my environment to production in config/bootstrap.js
In connections.js add connectTimeout: 20000 to make sure the request does not time out before the connection is made.
eg. process.env.NODE_ENV = 'development'
Ensure that the security group inbounds rules for the RDS allows connections from the security group associated with my EC2 instance.
Type: MySQL/Aurora
Protocol: TCP
Port Range: 3306
Source: < Your security group ID >
Following the above points also meant I overcame the issue with handshake timeouts when communicating with the RDS.
I've setup our heroku app with an amazon RDS instance.
I followed the guide here:
https://devcenter.heroku.com/articles/amazon_rds
This guide basically says to require SSL with the connection and then to input your RDS credentials.
This doesn't seem very secure to me. If someone has my db url, user and password then they can login from anywhere, correct? The SSL is nice to prevent sniffing of this info, but I'd like to lock it down further, to a machine, IP address or SSH.
I previously setup RDS DB instances where access was locked down to only specific IPs, but heroku no longer recommends this for whatever reason.
So the questions are:
Are my assumptions correct here?
How can I lock this down further?
Why doesn't heroku recommend locking it down to IP (or at least IP range)
I'll run this by heroku support as well and post an update, but wanted to get thoughts from the community.
Previously, Heroku recommended locking down access by referencing the Heroku AWS account ID. That approach is no longer recommended. The Heroku changelog entry lists the reasons, reproducing here for completeness:
Cross-security grants don't work with AWS VPC (which is now the default on AWS)
It's not safe because it grants access to all apps running on Heroku, not just yours
Doesn't work across AWS regions
Heroku may in the future run apps in a VPC or in a different region or use a different AWS account
We know that not all customers are happy with this level of access granularity, and we're continuously evaluating whether this is the optimal setup.
I want to configure mysql proxy on my test environment to observe the below.
1. Behavior of the proxy
2. How load, CPU usage varies on my test server for read/write distribution.
I googled and able to install proxy on my ubuntu linux.
But I didnt see any thing on configuring it in a step by step manner and how to start or stop this.
Shall some one explore on this and this would be of great help for me.
Thanks in advance
Regards,
UDAY
By default if you run the proxy on the same machine as the server it will listen to port 4040 and query a backend server on the msyql default port of 3036. Other port numbers and server locations can be configured from the command line or with a configuration file.
To distribute queries across servers, add monitoring, profiling etc. you need to provide a Lua script to mysql-proxy. See the example / tutorial scripts in /usr/local/share/docs that came with the installation download. There is work to do for a production implementation.
The basics of how the scripting works can be found here under MySQL Proxy Scripting.
Don't be worried about Lua. The syntax is quite readable given the tutorial examples to work from. As and when you need it lua.org has more details of Lua.