Scala, Akka Http, Heroku in sbt multi-project - scala

I'm starting with Heroku, I'm a developer that build Rest API using Scala and Akka Http.
Yesterday I was able to create a very simple API and deploy it in Heroku. To do I followed this example: https://dzone.com/articles/akka-http-from-zero-to-heroku-in-10-minutes
Then I decide to add complexity to the API so I created a new project: an sbt multi-project. Usually I do pretty much what is described in this example: https://pbassiner.github.io/blog/defining_multi-project_builds_with_sbt.html. The code of this project is located here: https://github.com/ovats/heroku-akka-multi.
In my local environment the project works fine. I start the service with:
sbt api/run
Then using curl I can make a request:
curl http://localhost:8080
So far so good.
The problem is: I can deploy it to Heroku (git push heroku master) but it wont run.
Using the heroku cli I can see in the logs:
...
2021-11-27T01:06:44.368868+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/heroku-akka-multi`
2021-11-27T01:06:46.211834+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2021-11-27T01:06:46.211994+00:00 app[web.1]: bash: target/universal/stage/bin/heroku-akka-multi: No such file or directory
2021-11-27T01:06:46.339690+00:00 heroku[web.1]: Process exited with status 127
2021-11-27T01:06:46.472410+00:00 heroku[web.1]: State changed from starting to crashed
2021-11-27T01:06:46.475832+00:00 heroku[web.1]: State changed from crashed to starting
...
Ok, I can see bash: target/universal/stage/bin/heroku-akka-multi: No such file or directory. I think this is related to the content of the file Procfile.
Is the problem the Procfile content?
Is the issue somewhere else?
It seems that Heroku does not know how to start the service, maybe where is the main class or something similar to this. What am I doing wrong?
Any help will be appreciated.

Related

How to setup Apache Atlas using embedded cassandra and Apache Solr

Step 1: Clone the repository.
git clone https://github.com/apache/atlas
Step 2: Generated tar file by executing below command
mvn clean -DskipTests package -Pdist,embedded-cassandra-solr
Step 3: Once the build is successful, extracted ‘apache-atlas-3.0.0-SNAPSHOT-server.tar’ file and executed below command.
.\bin\atlas_start.py
Seen below messages in console.
Starting Atlas server on host: localhost
Starting Atlas server on port: 21000
......................
Apache Atlas Server started!!!
But When I hit the url 'http://localhost:21000/', I am getting service unavailable message.
HTTP ERROR 503 Service Unavailable
URI: /
STATUS: 503
MESSAGE: Service Unavailable
SERVLET: -
Log files are empty, not sure how to identify the issue.
Couple of Questions
a. Do I need to explicitly setup cassandra and Apache solr for emebdded mode too? In that case please suggest me a documentation.
b. even though I generated the build using embedded cassandra file, while launching the application, it was still lokking for HADOOP_HOME property. Can I know the reason for this?
I got the same problem and, after a while, I found that Zookeeper doesn't start at all; so, I stopped the Zookeeper service and restarted the installation of atlas. (Here is the link of the installation that I followed : https://manjitsingh664.medium.com/apache-atlas-installation-guide-9098df98d5c3.)
For your case, replace:
mvn clean -DskipTests package -Pdist,embedded-hbase-solr
with:
mvn clean -DskipTests package -Pdist,embedded-cassandra-solr

How to connect local or external mongoDB instead of meteor's internal in Rocket.chat

Rocket.Chat Version: 0.56.0-develop
Running Instances: 1
DB Replicaset OpLog: Enabled
Node Version: v4.8.1
I cloned the git code and started rocket chat in my local machine Windods 7 by following instructions as bellow.
git clone https://github.com/RocketChat/Rocket.Chat.git
cd Rocket.Chat
meteor npm start
Now, I want during development my app to use my local mongoDB installation instead of meteors's internal. I tried a lot but did not get any help or clue. It seems I am missing somewhere. I attaching the screen of what I changed, I hope I am doing the right. I did changed in docker-compose.yml.

Deploying a meteor app using mongoLab and Heroku sandbox

I've checked a couple of blogs. Specially this one about deploying and hosting meteor on heroku using mongolab.
I follow the steps below:
Create a meteor app (just for test v.1.4) meteor create test
cd test
git init
git add .
git commit -m "tst"
heroku create pikachu
heroku config:set ROOT_URL="https://pikachu.herokuapp.com"
heroku config:set MONGO_URL="pikachu:este#dsxxx.mlab.com:xxx/pikachueste"
heroku buildpacks:set https://github.com/Pushplaybang/meteor-buildpack-horse
git push heroku master
After deployment the following error appears:
Starting process with command .meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js
Process exited with status 8
assert.js:93
throw new assert.AssertionError: "undefined" === "function"
at wrapPathFunction(/app/.meteor/heroku_build/app/programs/server/mini- files.js:77:10)
at Object.<anonymus>(/app/.meteor/heroku_build/app/programs/server/mini-files.js:108:24)
...
Process exited with status 8
State changed from starting to crashed
I've notice that when I try to install mongodb addon in my sandbox:
heroku addons:create mongolab:sandbox
The process finish with:
!Please verify your account to install this add-on plan ...
Does the problem occur because I cannot install mongodb addon?
Is it possible to install mongodb addon in a heroku sandbox?
Is there any other alternative?
Thanks,
one of the reasons for this error:
assert.js:93
throw new assert.AssertionError: "undefined" === "function"
at wrapPathFunction(/app/.meteor/heroku_build/app/programs/server/mini- files.js:77:10)
at Object.<anonymus>(/app/.meteor/heroku_build/app/programs/server/mini-files.js:108:24)
Is that the node version being run on heroku is different from the one meteor is using. So far, Meteor is using node v.4.5.0 and the one your buildpack is using is below that. I've used that buildpack once and had the same error.
You can use the original meteor buildpack horse and deal with the
Please verify your account to install this add-on plan ... by removing the mongolab addon. I experienced these issues myself. You can refer to this guide so it can be much clearer to you. It uses a fork of the original meteor buildpack horse without the mongolab addon. Just follow the guide and you'll be fine.

Using supervisor to run a flask app

I am deploying my Flask application on WebFaction. I am using flask-socketio which has lead me to deploying it with a Custom Websocket App (listening on port). Flask-socketio's instructs me to deploy my app by starting the serving with the call socketio.run(app, port= < port_listening_on >) in my main python script. I have installed eventlet on the server so socketio.run should run the app on the eventlet web server.
I can call python < app >.py and all works great – server runs, can view it at the domain, sockets working, etc. My problems start when I attempt to turn this into a long running process. I've been advised to use supervisor which I have installed and configured on my webapp following these instructions: https://community.webfaction.com/questions/18483/how-do-i-install-and-use-supervisord-to-control-long-running-processes
The problem is once I actually add the command for supervisor to run my app it errors with:
Exited too quickly
My log states the above error as well as:
(exit status 1; not expected)
In my supervisor config file I currently have the following program config:
[program:<prog_name>]
command=/usr/bin/python2.7 /home/<user>/webapps/<app_name>/<app>.py
autostart=true
autorestart=true
I have tried a removing and adding settings but it all leads to the same FATAL error.
So this is what part of my supervisor config looks like, I'm using gunicorn to run my flask app.
Also, I'm logging errors to a file from the supervisor config, so if you do that, it might help you see why it's not starting correctly.
[program:gunicorn]
command=/juzten/venv/bin/gunicorn run:app --preload -p rocket.pid -b 0.0.0.0:5000 --access-logfile "-"
directory=/juzten/app-folder-name
user=juzten
autostart=true
autorestart=unexpected
stdout_logfile=/juzten/gunicorn.log
stderr_logfile=/juzten/gunicorn.log

Application Error after deploying Meteor 1.0 app on heroku

I'm trying to deploy a meteor.js app (v 1.0) on heroku using the following buildpack:
https://github.com/AdmitHub/meteor-buildpack-horse
and following along this tutorial:
http://www.growthux.com/ux-html-css-js-growth-hack/installing-meteor-on-heroku
My app is more like a static website, i'm using the database to build a simple back office:
- storing the admin user and image paths which are then dynamically rendered in my templates.
After having created my app on Heroku, set ROOT_URL variable, set the MONGO_URL= variable to my external db on MONGO HQ, (tried mongo lab as well, same problem) and finally push to Heroku, i'm getting this error message when I visit the url:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
So I did:
2014-11-10T17:10:23.825922+00:00 heroku[web.1]: Stopping process with SIGKILL
2014-11-10T17:10:23.825723+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2014-11-10T17:10:24.584852+00:00 heroku[web.1]: State changed from starting to crashed
2014-11-10T17:10:24.574995+00:00 heroku[web.1]: Process exited with status 137
2014-11-10T17:10:26.415257+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cle-meteor.herokuapp.com request_id=ffc312a1-316d-4337-9165-caa492aa7c15 fwd="80.13.242.126" dyno= connect= service= status=503 bytes=
Not sure if I did something wrong regarding the deployment process, or if I must rethink how my app interact with the database when not running locally.
Any insights?
I had a similar issue, it turned out that I'd left off the "http://" from the ROOT_URL.
Your log messages are fairly generic, is there anything before that?
Here's how I got the meteor "todos" app running on heroku and mongolab.
Meteor on Heroku
Install meteor
curl install.meteor.com | /bin/sh
Add meteor to our path so we can run the "meteor" command from anywhere.
clone an existing meteor app into the heroku folder.
meteor create --example todos heroku
change to the meteor app's folder.
cd heroku
I added a package.json file that looks like the following.
{
"name": "myapp",
"version": "0.0.1",
"engines": {
"node": "0.10.33",
"npm": "1.4.23"
},
"dependencies": {
"fibers": "1.0.0"
}
}
change to our home folder. We want to come back to our previous spot.
pushd ~
get the heroku client and install it.
wget http://assets.heroku.com/heroku-client/heroku-client.tgz
tar -zxvf heroku-client.tgz
export PATH=${PATH}:${HOME}/heroku-client/bin
Go back to our previous location.
popd
login to heroku.
heroku login
SKIP THIS PART IF YOU ALREADY HAVE SSH CONFIGURED NICELY WITH HEROKU AND GITHUB
Add your public SSH key to heroku (if you haven't already done so)
heroku keys:add ~/keys/heroku_public_key_ssh.txt
(Manually) Ensure that public SSH key has also been added to your GitHub account.
If you're running ssh-agent, ensure your matching private SSH key is loaded
ssh-add ~/.ssh/id_rsa_heroku_github
Set up our subfolder as a git repository, which we will push to heroku. Substitute your own heroku app name for "mikestodos" below.
git init
heroku git:remote -a mikestodos
git add .
git commit -a -m "first deploy"
Create a heroku app. Mine is called mikestodos.
heroku create mikestodos --stack cedar --region us --buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git
Create a new mongolab database, and a new database user as well.
Set the MONGO_URL for heroku to be our MongoLabs database URL. The format is:
heroku config:set MONGO_URL=mongodb://<my_mongouser>:<my_mongodbpassword>#<mymongoserver>:<mymongoport>/<mymongodbname>
substitute your own MongoLabs URL below.
heroku config:set MONGO_URL=mongodb://mikestodos:<dbpassword>#ds051980.mongolab.com:51980/mikestodos
Set the ROOT_URL for our heroku app.
heroku config:set ROOT_URL=http://mikestodos.herokuapp.com
Now push our app to heroku.
git push heroku master