How to deploy Go server on Heroku with a MySQL database? - mysql

I am a complete beginner at hosting applications right now but am trying to get a hold of it.
- I have the MySQL database running locally on my PC. How to exactly should I host it somewhere online.
- When I tried to deploy my Go server on Heroku, I got the following error and couldn't find a solution for it anywhere online.
-----> App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/go.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
Any help in this regard would be appreciated!

To fix this problem you need to use some of vendoring tools - e.g. Godep, dep etc.
Heroku can't deploy golang app without 'vendor' folder

just run this command:
go mod init [app-name]
this will create a go mod file and a go sum for you
then run:
go get
to install those packages you called in your go app.
developers usually use go mod init github.com/name/repo
but go mod init [app-name]
will do the job!

Related

Elastic Beanstalk stops at EbExtensionPostBuild

I am having a problem deploying an EB instance with a custom .ebextensions file. This is the relevant part in that file:
container_commands:
01_migrate:
command: 'python db_migrate.py'
02_npm_build:
command: 'npm install && npm run prod'
As you can see, these commands are for migrating my PostgreSQL database (via a Flask backend) and building my React .jsx files.
If I leave these commands out, the deployment completes perfectly well. However, once I put them in, looking at the eb-activity.log it stalls at this part forever (as far as I can tell):
[2017-04-10T02:39:24.106Z] INFO [3023] - [Application deployment app-613e-170409_223418#1/StartupStage0/EbExtensionPostBuild] : Starting activity...
I also get this message on the Health overview in the console (this is after 1 day):
Performing application deployment (running for 1 day).
I have also tried to deploy it without those container_commands, and then including it back after the successful initial deployment. Then I get the same error message as before in eb-activity.log, and I also get this message on the Health overview:
Incorrect application version "app-2a3d-170409_214923" (deployment 1). Expected version "app-2a3d-170409_214923" (deployment 1).
Which is very strange because those two versions referenced are the same versions. I don't know what this means!
I found a solution.
Remove all you container_commands from .ebextensions/
Go ssh to instance, kill process with.
sudo killall python
Then Deploy new version without container_commands.
And start debuging all your container_commands, one by one on ssh..
Have fun.

Pod installation failed ? No module found

I'm running into problems with the installation of Alamofire and SwiftyJSON. I follwed the tutorial https://www.youtube.com/watch?v=Rqr3w8scm2E and https://www.youtube.com/watch?v=Brei27hdnF8&feature=iv&src_vid=Rqr3w8scm2E&annotation_id=annotation_700071403 which includes a description of the installation process.
I created the Pod file
and my pod install seemed to work as well
Now I'm not quite sure if I missed something. I thought maybe the two tests in the in the pod file need the two pods as well, but even after i tried that it still didn't work.
Can anyone tell me what i'm missing?
Thank you
Did you forgot to open the <your project name>.xcworkspace file with Xcode in your project root folder instead of the regular <your project name>.xcodeproj?
CocoaPods creates <your project name>.xcodeproj for you once you install the pods and requires you to use it from that moment on. You can type in the terminal open <your project name>.xcodeproj and Xcode will open it for you.

Openshift: how to import MySQL driver to the tomcat/lib directory

I would like to connect my web application (running on tomcat 7) to MySQL (v5.6.20). It is ok if I include the driver mysql-connector-java-5.1.31-bin.jar into my web application. But would like to have it for all my apps. On my local computer, I put the file in tomcat/lib and everything is fine.
How to do the same with openshift? Is it a bad idea to do so?
I am a total beginner. What I do to upload my application (war files) is
git add --all
git commit --m "text"
git push
Thanks a lot for your help!!
Here are two KB articles from the Help Center that I think will help you get going, the first shows how to use the pre-configured database connections that come with each of the Java containers on OpenShift (https://help.openshift.com/hc/en-us/articles/202399720-How-to-use-the-pre-configured-MySQLDS-and-PostgreSQLDS-data-sources-in-the-Java-cartridges), They are very easy to use.
The second shows you how to include external libraries (jar files) inside your application without using maven (https://help.openshift.com/hc/en-us/articles/202399730-How-to-include-libraries-jar-files-in-your-java-application-without-using-Maven).
A third option, if you are using a Maven based project (similar to the default applications that come with the Java cartridges), is to add the mysql driver as a dependency to your pom.xml file, and it will be loaded into the correct place in your application when you do a git push. If you want to go that route, I think that this article will help: http://www.java-tutorial.ch/core-java-tutorial/mysql-with-java-and-maven-tutorial

Trying to run foreman on OpenShift, having cartridge issues

Does anyone know why running
rhc app create test ruby-2.0 mysql-5.5 http://cartreflect-claytondev.rhcloud.com/reflect?github=cantino/openshift-foreman-cartridge
works on OpenShift, but running
rhc app create test ruby-2.0 mysql-5.5 http://cartreflect-claytondev.rhcloud.com/reflect?github=cantino/openshift-foreman-cartridge -s
gives the following error:
Creating application 'test' ... cantino-foreman-0.63.0 cannot be embedded in scalable app 'test'.
I want to be able to run this as a scalable app, so that I can run one gear with MySQL and the other with foreman and passenger (ruby-2.0).
Any help appreciated! Is my custom cartridge misconfigured?
It turned out that #ncdc on GitHub was able to solve my issue.
https://github.com/ncdc/openshift-foreman-cartridge/issues/1
We needed to add plugin as a category.

FreePascal & OpenShift

any one has experience with Open Shift and install FreePascal as a cartridge?
I found this but I don't know how make it work :
https://github.com/jhadvig/openshift-pascal-cartridge
I want to know what is the instruction of making FreePascal cartridge.
The following command should install that cartridge for you
rhc app create freepascal https://cartreflect-claytondev.rhcloud.com/reflect?github=jhadvig/openshift-pascal-cartridge
Basically since the manifest.yml file does not contain a Source-Url definition, you need to run it through the cartridge reflector as i did above.
Unfortunately that cartridge also does not seem to install correctly. You should leave an "issue" using the issues tab on that cartridge asking if it is ready for production use or not.
If you want to develop your own cartridge, you can read through the cartridge developers guide here: http://openshift.github.io/documentation/oo_cartridge_developers_guide.html