Couchbase on Heroku - heroku

This might be a general question, but I have a simple "gym log" app, written in node and I am using Couchbase as the database. Everything works when I run it on my machine. The problem arises when after I've deployed it to Heroku and try to run it. When I check the logs I get the error that module couchbase could not be found.
Do I have to add an add-on to heroku or define couchbase as a dependency in my package.json for my app to work on heroku?
Could someone give me some pointers please?
Here is the link to all my code:
github/MMRibot/loGym

The error "module couchbase could not be found" means your Node app can't find the couchbase module. You most likely installed it locally with "npm install couchbase", so it works on your machine. To have it working on Heroku, you have to add the couchbase module dependency to your package.json file.
"dependencies": {
"hapi": "^6.0.2",
"joi": "^4.6.1",
"request": "^2.37.0",
"underscore": "^1.6.0",
"couchbase": "*"
}
Replace "*" with a specific version if you don't want to use the latest (2.0.3 as of this writing.)

Related

Incorrect application version found on all instances. Expected version

Good day, I hosted my Laravel application on AWS Beanstalk, through the console, the earlier versions are working because I have deployed other versions before and they worked, however, I deployed today and my health check is reading degraded, when I opened the health check, I am seeing
Incorrect application version "Sample Application-10" (deployment 9). Expected version "Sample Application-14" (deployment 17).
please, is there a way to resolve this without rebooting my environment
If you are using the NodeJS app, delete the package-lock.json file and node_modules folder. Reinstall all packages with "npm i" and redeploy with "eb deploy".

Deploying Strapi to Heroku

I've been following the official Strapi tutorials on how to develop and deploy an application to Heroku and it seems you have to configure some files like ./config/environments/**/database.json.
The problem is that, installing the app without --quickstart (yarn create strapi-app my-project), my config folder just has a functions folder and database.js and server.js files.
Should I create manually this database.json or is this supposed to be created automatically when initializing the app without --quickstart?
I was also confused so I manually created the folders /environments/production and inside the file database.json and it worked for me.
Link to the docs: https://strapi.io/documentation/3.0.0-beta.x/deployment/heroku.html#_4-update-your-database-config-file

Problem with deploying Go app to Google App Engine

I developed my first Go app and decided to deploy it to Google Cloud (App Engine). It was running perfectly fine locally but I run into a few issues during the deployment (I'm using Cloud SDK).
I eventually got to the point where I was able to successfully deploy it to GCP but I keep getting
when trying to access the app.
I cannot do any local development either because every time I run go run main.go, go get -u, go build I'm getting:
go: finding module for package github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql
go: found github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql in github.com/GoogleCloudPlatform/cloudsql-proxy v0.0.0-20200513164142-a9864b03c326
go: github.com/GoogleCloudPlatform/cloudsql-proxy#v0.0.0-20200513164142-a9864b03c326 requires
cloud.google.com/go#v0.56.0 requires
cloud.google.com/go/bigquery#v1.4.0 requires
cloud.google.com/go#v0.52.0 requires
cloud.google.com/go/bigquery#v1.0.1/go.mod: verifying module: cloud.google.com/go/bigquery#v1.0.1/go.mod: cannot authenticate record data in server response
My go.mod file looks like this:
module swanson
go 1.14
require github.com/gorilla/mux v1.7.4
and this is the structure of my app (main.go, models, and router are 3 different packages):
I'm new to Go development and never deployed a Go app to GCP so feeling quite lost, any help would be much appreciated.
I have tried deploying a go application in app engine and also running it locally and both worked.
I used
this application
in github, which you can clone with the command:
git clone https://github.com/GoogleCloudPlatform/golang-samples
The command I have used for running the application locally is :
go run helloworld.go
And the command returned the following message:
2020/05/22 11:34:16 Defaulting to port 8080
2020/05/22 11:34:16 Listening on port 8080
Then in the Cloud Shell I have opened the web preview in the port 8080 and it was working as expected.
For more information about the deployment, you can check this documentation.

Ionic PWA deploy

I'm trying to deploy a Progressive Web App version of my Ionic 2 project to Heroku but it doesn't seem to work. What I'm trying is to use "Ionic build browser --prod" and then deploy the www folder, but I'm not getting any response from Heroku (Seems that nothing has being deployed)
The steps you are supposed to take:
Ionic build browser --prod - creates the main.js file to be deployed
Go to .gitignore file and remove the mentions of www/ so git picks it up and add these two lines so platforms browsers folder is picked up
platforms/*
!platforms/browser/
!platforms/browser/www
!platforms/browser/www/plugins
Add these 2 libraries to your package.json (don't forget to run npm install)
"connect": "^3.5.0",
"serve-static": "^1.11.1"
Add a start to your npm scripts in package.json
"start": "node server.js"
Add server.js to your project folder with the following code:
var connect = require('connect'),
serveStatic = require('serve-static');
var app = connect();
app.use(serveStatic("platforms/browser/www"))
app.listen(process.env.PORT || 5000);
Please note this code is only for ionic apps and not normal angular apps.
At this point you can write npm start or node server.js in your cmd and you can test to see how it will run.
Commit your code to heroku git using git push heroku master. Please note to have the heroku git on your remote list. You may do git remote -v to check if thats the case. If not get the url from the website and add it.
Optional - Put the www/ folder back in .gitignore and git rm --cached -r ./www to delete them from your git. This is so your co workers wont have merge conflicts on your main.js everytime you commit. The same for platforms/browser.
You are supposed to see heroku installing and deployed a node application in your enviornment after pushing to their git
NOTE If you are using Heroku you could probably do this with Heroku builds rather than playing with your git. https://github.com/heroku/heroku-builds
An update, as i ran the same task today:
It may be preferable to avoid
Adding and maintaining "server" code along with your app.
Pushing the built app (www/) in your version control system.
You can rely just on the heroku buildpacks. To do that you would need two buildpacks:
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/heroku/heroku-buildpack-static.git
Your app will be detected first as node app and will build, and later as a static site and served.
First, build the app up on heroku, don't add www to your version control system:
The first buildpack will detect your app as node app, and run the build after the postbuild script.
you need to add this line to you package.json scripts:
"heroku-postbuild": "ionic build --prod"
and add the ionic cli to your dev-dependencies so it can be available for heroku on the build process
npm install ionic --save-dev
Second, serve the static files generated:
The second buildpack will serve the static files generated in www. For that you need to tell the buildpack how to serve the files with a static.json file: (this one is somewhat equivalent to the config for firebase in the ionic docs)
/static.json:
{
"routes": {
"/**": "index.html"
},
"headers": {
"ngsw-worker.js": {
"Cache-Control": "no-cache"
},
"/build/app/**": {
"Cache-Control": "public, max-age=31536000"
}
},
"root": "www/"
}
Looks like the new Ionic doesn't generate the 'www/build/app/...' directory anymore, just added to be consistent with the above mentioned docs.
Just those two changes, along with the buildpacks are enough to run the PWA on heroku / dokku

Deploying phoenix framework on heroku with webpack

I followed the docs in the official website. The problem is I use webpack as my bundler instead of brunch. The deployment is successful. I can even access the api routes. My only problem is the assets (js,css) in the homepage is not found. Locally, I can access the home page successfully when I run mix phoenix.server.
I tried peeking at the priv/static folder in heroku (using heroku run bash) where the files are moved after being compiled and saw the asset files there. Did I miss anything? or a configuration that I should put?
Here is the remote deploy output
http://pastebin.com/1mL1YWTS
Here is my custom compile file (to override phoenix-static buldpack)
http://pastebin.com/BGHf9xBK
Here is my webpack.config.js
http://pastebin.com/Xv2E1yCE
I have used webpack with the following compile:
./node_modules/.bin/webpack -p
mix phoenix.digest
You need to call mix phoenix.digest to generate a manifest that can be used in the static path helpers. http://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Digest.html#run/1

Resources