Does a db:migrate on Heroku alter the production database? - ruby-on-rails

I'm working with a small app on Heroku and I'm wondering if a heroku run rake db:migrate will affect the production database. Any thoughts?
I tried heroku db:pull but the pull stopped midway (not to mention that it screwed up my local db):
Schema: 60% |==================================================================================== | ETA: 00:00:16
Saving session to pull_201207010723.dat..
!!! Caught Server Exception
HTTP CODE: 503
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
html, body, iframe { margin: 0; padding: 0; height: 100%; }
iframe { display: block; width: 100%; border: none; }
</style>
<title>Application Error</title></head>
</head>
<body>
<iframe src="//s3.amazonaws.com/heroku_pages/error.html">
<p>Application Error</p>
</iframe>
</body>
</html>
Additional notes: local development db is sqlite3 and production db (by Heroku standard is postgresql). The devel db was like that by default and I couldn't find a nice tutorial to convert to postgresql.
Thanks a bunch!

Running heroku run rake db:migrate will indeed alter your database on Heroku -- so it will change your production database.

Related

How to get access the corporate docker hub inside docker-in-docker?

I have a corporate proxy and docker registry(nexus). When I execute the command:
docker login -u <corporate_login> -p <pass> https://nexus-corporate.com,
I get a successful connection. But when I use docker-in-docker image and execute a similar command, there are problems with proxy. How to solve problem?
Error message:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2018 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
/*
* Copyright (C) 1996-2018 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
/*
Stylesheet for Squid Error pages
Adapted from design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
*/
.....
body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
--></style>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: http://docker:2375/v1.40/auth</p>
<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>
<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>
<p>Your cache administrator is admin#my_company.com.</p>
<br>
</div>
<hr>
<div id="footer">
<p>Generated Mon, 27 Jan 2020 08:39:45 GMT by proxy.my_company_domain (squid/4.4)</p>
<!-- ERR_ACCESS_DENIED -->
</div>
</body></html>

Quality Gates 500 error

I am using the SonarQube quality gates plugin for Jenkins.
My project has SonarQube ID com.my.package:my-project:origin/feature/WRAP-1-test and URI com.my.package:my-project:origin%2Ffeature%2FWRAP-1-test.
In Jenkins, under Quality Gates, Project Key, I tried using both the ID and the URI.
However, on both occasions when I build the project, I am getting:
SonarQube analysis completed: SUCCESS
quality.gates.jenkins.plugin.QGException: Expected status 200, got: 500. Response: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>SonarQube</title>
<style type="text/css">
body {
background-color: #fff;
color: #666;
text-align: center;
font-family: arial, sans-serif;
}
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 {
font-size: 100%;
color: #f00;
line-height: 1.5em;
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>Please try back in a few minutes and contact support if the problem
persists.</p>
<p>
<!-- SONAR-4447 Sometimes this error page is served as static html so we hide ruby code -->
Go back to the homepage
<!-- -->
</p>
</div>
</body>
</html>
at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59)
at quality.gates.sonar.api.SonarHttpRequester.getAPIInfo(SonarHttpRequester.java:47)
at quality.gates.sonar.api.QualityGatesProvider.getRequesterResult(QualityGatesProvider.java:34)
at quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:29)
at quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:20)
at quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:73)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1067)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
at hudson.model.Run.execute(Run.java:1753)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Build step 'Quality Gates' marked build as failure
Finished: FAILURE
Any idea why the call fails?
EDIT:
My logs contain the following 2 errors:
2017.02.14 15:25:48 ERROR web[AVoyVzS5I0AJ4yijAAU1][rails] Fails to execute http://localhost:9000/api/events?resource=com.my.package:my-project:origin/feature/WRAP-1-test&format=json&categories=Alert : undefined method `generate' for #<JSON::Ext::Generator::State:0x2f8ea6a2>
And:
web.log:2017.02.14 15:25:48 ERROR web[AVoyVzS5I0AJ4yijAAU1][o.s.s.ui.JRubyFacade] Fail to render: http://localhost:9000/api/events?resource=com.my.package:my-project:origin/feature/WRAP-1-test&format=json&categories=Alert
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/json-1.8.3/lib/json/common.rb:470:in `JSON'
/Users/octavian/Downloads/sonarqube-6.2/web/WEB-INF/app/controllers/api/api_controller.rb:48:in `jsonp'
/Users/octavian/Downloads/sonarqube-6.2/web/WEB-INF/app/controllers/api/api_controller.rb:132:in `error_to_json'
/Users/octavian/Downloads/sonarqube-6.2/web/WEB-INF/app/controllers/api/api_controller.rb:123:in `render_response'
My version of SonarQube is 6.2.
For anyone having this issue, my steps for solving irwere:
open sonarqube-6.2/web/WEB-INF/config/environment.rb, and change to ENV['GEM_PATH']=''.
go to the folder where sonar.sh is and run unset GEM_PATH
sonar.sh restart
The issue is caused by some incompatibilities with the installed version of ruby.

Install Hue in Amazon EMR

I tried installing Hue in Amazon EMR using the link https://github.com/cloudera/hue .I am seeing the status
development server running at http://127.0.0.1:8000/
Am also able to curl the url and but getting blank page. The curl content.
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="refresh" content="0; url=/beeswax">
</head>
<body>
</body>
</html>"
But when I hit the browser using the public dns url with port 8000 i am getting error page. Am i missing any steps.
Thanks
What error page are you seeing? It could be just that you did no open 8000 or binded the server on runserver 0.0.0.0:8000 when started it. Also it is recommended to start Hue with runcpserver instead of the development server.
You are running on the loopback interface 127.0.0.1. This is only accessible from the host not externally. You need to change you hue.ini
and set:
http_host=0.0.0.0

heroku db:pull strange response

i run
$ heroku db:pull
it says
Loaded Taps v0.3.24
Auto-detected local database: mysql2://root:mypassword#127.0.0.1/app?encoding=utf8
Warning: Data in the database 'mysql2://root:mypassword#127.0.0.1/app?encoding=utf8' will be overwritten and will not be recoverable.
! WARNING: Destructive Action
! This command will affect the app: heroku-app-9999
! To proceed, type "heroku-app-9999" or re-run this command with --return heroku-app-9999
so i run
$ cryptic-harbor-6329
then i get this response:
! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
! <html>
! <head>
! <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
! <style type="text/css">
! html, body, iframe { margin: 0; padding: 0; height: 100%; }
! iframe { display: block; width: 100%; border: none; }
! </style>
! <title>Application Error</title></head>
! </head>
! <body>
! <iframe src="//s3.amazonaws.com/heroku_pages/error.html">
! <p>Application Error</p>
! </iframe>
! </body>
! </html>
i have pulled and pushed to heroku with different apps many times. i have never received this error. what dose it mean?
heroku db:pull mysql://root:mypass#localhost/mydb
try this

Getting an 'Application Error' when trying to push my database to Amazon RDS with the heroku gem

Whenever I try to push my local mysql database to Amazon RDS I get a 503 application error:
bundle exec heroku db:push
...
Sending schema
Schema: 40% |================ | ETA: 00:00:38
Saving session to push_201106170529.dat..
!!! Caught Server Exception
HTTP CODE: 503
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
html, body, iframe { margin: 0; padding: 0; height: 100%; }
iframe { display: block; width: 100%; border: none; }
</style>
<title>Application Error</title></head>
</head>
<body>
<iframe src="https://s3.amazonaws.com/heroku_pages/error.html">
<p>Application Error</p>
</iframe>
</body>
</html>
I'm using taps 0.3.23
While the error message is similar to the one reported here : Heroku help Amazon RDS rails push database error my problem is not related to Amazon's security group as this is already configured.
Anybody else encountering this issue?
I got the same HTML response message and HTTP error code using Heroku with a CURL POST request.
Executing heroku logs | tail gave me more insights:
2016-04-20T10:56:17.509354+00:00 heroku[router]:
at=error code=H12 desc="Request timeout" method=POST [...]
The H12 error denotes a request timeout. That means an "HTTP request took longer than 30 seconds to complete" [1].
More on request timeouts on https://devcenter.heroku.com/articles/request-timeout.
[1] https://devcenter.heroku.com/articles/error-codes#h12-request-timeout
I had the same response with heroku db:push, the first time I attempted.
However, when I ran it a second time, there was no error, and the db pushed.

Resources