I have to deploy a SonarQube server on Heroku Web Dyno.
For this I have tried below items:
Downloaded the SonarQube Community Edition from
https://www.sonarqube.org/downloads/
Then I unzipped the folder and went into /sonarqube-7.8/ folder
Then I have created the Procfile with following content:
web: chmod u+x bin/linux-x86-64/sonar.sh &&
./bin/linux-x86-64/sonar.sh
Then I have created the system.properties file with below content:
java.runtime.version=1.8
Then I ran below commands to check in the SonarQube Server on Heroku Git and
ran the server:
git init
git add.
git commit -m "initial commit"
git push heroku master
The git bash console shows following after running the above mentioned commands:
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 391 bytes | 39.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> SonarQubeFramework app detected
remote: -----> Create setupSonar.sh
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 195.5M
remote: -----> Launching...
remote: Released v8
remote: https://<app_name>.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/<app_name>.git
cad2f14..55d4bcd master -> master
And I am getting below logs from on heroku
2019-06-28T10:54:19.321815+00:00 heroku[web.1]: Starting process with command `chmod u+x bin/linux-x86-64/sonar.sh && ./bin/linux-x86-64/sonar.sh`
2019-06-28T10:54:21.360549+00:00 heroku[web.1]: Process exited with status 1
2019-06-28T10:54:21.380868+00:00 heroku[web.1]: State changed from starting to crashed
2019-06-28T10:54:21.313195+00:00 app[web.1]: Usage: ./bin/linux-x86-64/sonar.sh { console | start | stop | force-stop | restart | status | dump }
Can anyone help me in deploying SonarQube Server on Heroku Cloud??
I am able to deploy the SonarQube server on Heroku Cloud:
Below are the commands to be executed in the same order:
heroku create <appName>
heroku addons:create heroku-postgresql:hobby-dev -a <appName>
heroku buildpacks:set https://github.com/NayaraCaetano/heroku-buildpack-sonarqube.git -a <appName>
mkdir <appName> && cd <appName>
touch README
git init
heroku git:remote -a <appName>
git add .
git commit -am "initial commit"
git push heroku master
heroku dyno:resize performance-m -a <appName>
Note: You have to use performance-m dyno (which is not free) on Heroku due to some memory constraints. Also free version of
Postgres will get exhausted within 1 or 2 scans, so you have to
upgrade it as per your need.
Related
I tried to push a project that I'd made locally to github and there was an error since I had created a repo on github with a license instead of leaving it empty. When I attempted to push the current local save to the remote repo, git bash would say there was nothing to commit, working tree clean even though the repo was empty save for the license and the local project was full of files.
I deleted the repo on github, but git bash still says (main) when I pull up the project. I normally start the repo on github and then git clone, and this is my first time trying to go the opposite way.
I deleted the original remote repo that the project was supposed to be for, and made a new one that is completely empty. I tried
git remote add origin git#github.com:manyLizards/node-tutorial.git;
error: remote origin already exists.
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git branch -M main
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git push -u origin main
Enter passphrase for key '/c/Users/HP/.ssh/id_ed25519':
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 1.75 KiB | 1.75 MiB/s, done.
Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
To github.com:manyLizards/node-tutorial.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git add -A
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git commit -m"initialized github repo"
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git push origin --delete main
Enter passphrase for key '/c/Users/HP/.ssh/id_ed25519':
To github.com:manyLizards/node-tutorial.git
! [remote rejected] main (refusing to delete the current branch: refs/heads/main)
error: failed to push some refs to 'github.com:manyLizards/node-tutorial.git'
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git branch --delete --remotes origin/branch-name
error: remote-tracking branch 'origin/branch-name' not found.
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git branch --delete --remotes origin/main
Deleted remote-tracking branch origin/main (was dba3d90).
HP#DESKTOP-A0NOAM6 MINGW64 ~/SideProjects/node-tutorial (main)
$ git fetch origin --prune
Enter passphrase for key '/c/Users/HP/.ssh/id_ed25519':
From github.com:manyLizards/node-tutorial
* [new branch] main -> origin/main`
I assume you don't need to make a copy of your remote since you already have deleted that. Run
git remote remove origin
which removes the origin, in your case main. Also, you can change the URLs in .git\config to set for new URLs without removing the remote repo.
see hobbs's answer
We are in process of upgrading the heroku stack from 18 to 22. After clicking on upgrade while we are trying to redeploy the app we are getting the below error while doing git push:
error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'
We are following the below steps to redeploy:
$ heroku git:clone -a test
$ cd test
$ git add .
$ git commit -am "make it better"
$ git push heroku master
Also we have followed the below steps from CLI as well
To upgrade via the Heroku CLI, use the stack:set command on your production app:
heroku stack:set heroku-22 -a test
Setting stack to heroku-22... done
You will need to redeploy ⬢ for the change to take effect.
Run git push heroku main to trigger a new build on ⬢ .
git commit --allow-empty -m "Upgrading to heroku-22"
[master (root-commit) 89fea09] Upgrading to heroku-22
git push heroku master
Enumerating objects: 2, done.
Counting objects: 100% (2/2), done.
Writing objects: 100% (2/2), 185 bytes | 185.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: pathspec '.' did not match any file(s) known to git.
remote:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote:
To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c#bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.
We are getting the below error here:
remote: error: pathspec '.' did not match any file(s) known to git.
remote:
remote: ! Heroku Git error, please try again shortly.
remote: ! See http://status.heroku.com for current Heroku platform status.
remote: ! If the problem persists, please open a ticket
remote: ! on https://help.heroku.com/tickets/new
remote:
To https://git.heroku.com/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test.git'
bhattacharjee.c#bhattac-ltmynzq ei-mule-dashboard-ee1 % git push heroku main
error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/test.git'.
Could you please help us in resloving the issue.
We are following the below steps to redeploy:
$ heroku git:clone -a test
First of all, you shouldn't be doing this:
A Heroku app’s Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. Do not use this repository as your app’s canonical “origin” repository. Instead, use your own Git server or a version control service such as GitHub.
If this is part of your regular workflow, please adjust accordingly. Heroku is not a source code management platform.
Now, onto the problem:
src refspec master does not match any
You simply don't have a master branch.
Heroku builds from one of two branches: main (which is newer and slowly becoming the community standard default branch name) and master (legacy).
If you don't have a master branch, you almost certainly have a main branch that Heroku will happy build from:
git push heroku main
If you need to deploy from some other branch another-branch, you still need to push to main (or master) on Heroku:
git push heroku another-branch:main
Finally, please don't actually use "make it better" as a commit message. Spend some time making commit messages clear and meaningful. There is lots of good advice floating around about how you can do that.
I am writing a simple script that will run in a one-off heroku dyno (launched using the heroku run command). The script's objective is to get the hash of the latest commit on the master branch of my repo and set one of the heroku config variables to that.
I'm trying to execute the following commands to clone the repo into the heroku dyno, change directories to be in the directory created by the clone and then set the config variable to be the desired value.
heroku run "git clone https://`heroku config:get GITHUB_TOKEN`#github.com/<org>/<repo>.git && cd <repo> && `heroku config:set CURRENT_HASH=`git rev-parse HEAD``"
When I execute any and all of the commands that follow heroku run in my local terminal, it works fine. However, when I execute the command written above in a one-off dyno using heroku run, heroku config:set is invoked first and it sets the config variable CURRENT_HASH to an empty string. Then the git clone executes successfully (the config variable GITHUB_TOKEN is correctly read) and then git rev-parse HEAD is executed. So the output is like this:
Setting CURRENT_HASH and restarting <heroku app name>... done, v246
Running git clone https://<GITHUB_TOKEN>#github.com/<org>/<repo>.git; cd <repo>; git rev-parse HEAD on ⬢ <heroku app name>... up, run.1538 (Hobby)
Cloning into '<repo>'...
remote: Enumerating objects: 330, done.
remote: Counting objects: 100% (330/330), done.
remote: Compressing objects: 100% (222/222), done.
remote: Total 4635 (delta 123), reused 269 (delta 98), pack-reused 4305
Receiving objects: 100% (4635/4635), 8.95 MiB | 9.27 MiB/s, done.
Resolving deltas: 100% (2425/2425), done.
bbb748d543a511eed4986cddb68b292ce1be67ad //hash of the last commit
What I don't understand is why heroku config:set is executed first even though it's the last command. Also, when I try to execute heroku config:get or heroku config:set using heroku run without the backticks, the script fails with the error bash: heroku: command not found. That is why I use nested backticks for heroku config:set... and git rev-parse HEAD in order for the command not to fail with an error.
Any help would be very much appreciated.
I have an existing git repo for my personal website, which I am porting to Sinatra (mainly for templating, it's a static site). I do NOT want to lose/reset this git repository.
When I try to push to Heroku, I get the error below. I have a config.ru file, a Gemfile, and a Gemfile.lock, along with some other stuff for Sinatra. Running rackup works, running bundle exec rackup works, and I didn't get any warnings from Heroku about missing dependencies.
Am I missing something? I can post the directory structure of my site if it would help (though it's close sourced).
~/Repos/website ➜ gp heroku master
Counting objects: 2836, done.
Compressing objects: 100% (2669/2669), done.
Writing objects: 100% (2836/2836), 3.48 MiB | 252 KiB/s, done.
Total 2836 (delta 481), reused 2117 (delta 155)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:APP_NAME_HERE.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:APP_NAME_HERE.git'
A Cedar app should recognise the config.ru file and create a web process for you, so it's possible that some essential file is not tracked by git. Check that config.ru, Gemfile and Gemfile.lock are all committed (you can use git status, but note that it will not output anything for ignored files so you should also check your .gitignore file).
If all the files are committed, you could also try specifying the command you want the web process to use in a Procfile. See the Heroku docs for more information:
Getting started with Ruby: Declare process types with Procfile
Declaring and Scaling Process Types with Procfile
Problem solved. I was working on a git branch especially for Heroku/Sinatra support, and it turns out I was running git push heroku master, which pushed local master to remote master. The master branch did not have a valid Heroku app. I assumed it would push the current local branch to the remote master branch, which is not the case. git push sinatra:master solved the issue.
For those who find that the accepted answer doesn't solve their problem, this related question may provide the solution: "Heroku push rejected, no Cedar-supported app detected" when trying to upload a Sinatra app with an existing git repo
Everybody,
I get an error when I run this command: "git push heroku master". The error log shows the following:
$ git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Rails or Rack app detected
To git#heroku.com:simple-earth-536.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#app_name.git'
Any idea what could cause this? I welcome any suggestions, thanks all.
This means that you are not in a rails application, such as if you are not in the correct directory.
Make sure you are actually in your apps directory.
rails myapp
cd myapp
This is the flow you should go through"
rails new_app
git init
git add .
git commit -m 'master'
heroku create
git push heroku