I'm learning Heroku. I tried to deploy a Node.js app on Heroku. Build seems to be successful, but the browser shows App-error.
https://warm-coast-28316.herokuapp.com/
Why?
Here is the log. Is there something suspicios?
-----> Node.js app detected
-----> Creating runtime environmen
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=0.12.7 <0.13
engines.npm (package.json): ~2.11.3
Resolving node version >=0.12.7 <0.13 via semver.io...
Downloading and installing node 0.12.18...
Resolving npm version ~2.11.3 via semver.io...
Downloading and installing npm 2.11.3 (replacing version 2.15.11)...
-----> Restoring cache
Skipping cache restore (new runtime signature)
-----> Building dependencies
Installing node modules (package.json)
> ws#0.4.32 install /tmp/build_beb218743747080f27aa5afd85781f8f/vheinitz-reatha-7a0950a/node_modules/node-hl7/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_beb218743747080f27aa5afd85781f8f/vheinitz-reatha-7a0950a/node_modules/node-hl7/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
COPY Release/bufferutil.node
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/obj.target/validation.node
COPY Release/validation.node
make: Leaving directory `/tmp/build_beb218743747080f27aa5afd85781f8f/vheinitz-reatha-7a0950a/node_modules/node-hl7/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
module#0.0.1 node_modules/module
periodic-task#0.1.2 node_modules/periodic-task
cookie-parser#1.3.5 node_modules/cookie-parser
├── cookie#0.1.3
└── cookie-signature#1.0.6
debug#2.2.0 node_modules/debug
└── ms#0.7.1
jsonfile#2.4.0 node_modules/jsonfile
└── graceful-fs#4.1.11
morgan#1.5.3 node_modules/morgan
├── basic-auth#1.0.4
├── depd#1.0.1
└── on-finished#2.2.1 (ee-first#1.1.0)
string#3.3.3 node_modules/string
node-mv#0.1.3 node_modules/node-mv
├── progress#1.1.8
├── async#0.9.2
└── commander#2.9.0 (graceful-readlink#1.0.1)
serve-favicon#2.2.1 node_modules/serve-favicon
├── fresh#0.2.4
├── parseurl#1.3.1
├── ms#0.7.1
└── etag#1.6.0 (crc#3.2.1)
gm#1.23.0 node_modules/gm
├── array-series#0.1.5
├── array-parallel#0.1.3
└── cross-spawn#4.0.2 (lru-cache#4.0.2, which#1.2.12)
express#4.12.4 node_modules/express
├── cookie-signature#1.0.6
├── fresh#0.2.4
├── merge-descriptors#1.0.0
├── parseurl#1.3.1
├── content-type#1.0.2
├── utils-merge#1.0.0
├── cookie#0.1.2
├── methods#1.1.2
├── escape-html#1.0.1
├── range-parser#1.0.3
├── vary#1.0.1
├── finalhandler#0.3.6
├── serve-static#1.9.3
├── content-disposition#0.5.0
├── path-to-regexp#0.1.3
├── depd#1.0.1
├── on-finished#2.2.1 (ee-first#1.1.0)
├── qs#2.4.2
├── etag#1.6.0 (crc#3.2.1)
├── send#0.12.3 (destroy#1.0.3, ms#0.7.1, mime#1.3.4)
├── proxy-addr#1.0.10 (forwarded#0.1.0, ipaddr.js#1.0.5)
├── type-is#1.6.14 (media-typer#0.3.0, mime-types#2.1.14)
└── accepts#1.2.13 (negotiator#0.5.3, mime-types#2.1.14)
body-parser#1.16.0 node_modules/body-parser
├── bytes#2.4.0
├── content-type#1.0.2
├── depd#1.1.0
├── on-finished#2.3.0 (ee-first#1.1.1)
├── raw-body#2.2.0 (unpipe#1.0.0)
├── http-errors#1.5.1 (setprototypeof#1.0.2, inherits#2.0.3, statuses#1.3.1)
├── qs#6.2.1
├── debug#2.6.0 (ms#0.7.2)
├── type-is#1.6.14 (media-typer#0.3.0, mime-types#2.1.14)
└── iconv-lite#0.4.15
request#2.79.0 node_modules/request
├── is-typedarray#1.0.0
├── aws-sign2#0.6.0
├── oauth-sign#0.8.2
├── forever-agent#0.6.1
├── tunnel-agent#0.4.3
├── caseless#0.11.0
├── stringstream#0.0.5
├── isstream#0.1.2
├── json-stringify-safe#5.0.1
├── extend#3.0.0
├── aws4#1.5.0
├── uuid#3.0.1
├── combined-stream#1.0.5 (delayed-stream#1.0.0)
├── qs#6.3.0
├── form-data#2.1.2 (asynckit#0.4.0)
├── mime-types#2.1.14 (mime-db#1.26.0)
├── tough-cookie#2.3.2 (punycode#1.4.1)
├── har-validator#2.0.6 (pinkie-promise#2.0.1, commander#2.9.0, chalk#1.1.3, is-my-json-valid#2.15.0)
├── hawk#3.1.3 (cryptiles#2.0.5, sntp#1.0.9, boom#2.10.1, hoek#2.16.3)
└── http-signature#1.1.1 (assert-plus#0.2.0, jsprim#1.3.1, sshpk#1.10.2)
multer#0.1.6 node_modules/multer
├── qs#1.2.2
├── mkdirp#0.3.5
└── busboy#0.2.14 (readable-stream#1.1.14, dicer#0.2.5)
connect-busboy#0.0.2 node_modules/connect-busboy
└── busboy#0.2.14 (readable-stream#1.1.14, dicer#0.2.5)
nodemon#1.11.0 node_modules/nodemon
├── ignore-by-default#1.0.1
├── undefsafe#0.0.3
├── es6-promise#3.3.1
├── minimatch#3.0.3 (brace-expansion#1.1.6)
├── touch#1.0.0 (nopt#1.0.10)
├── lodash.defaults#3.1.2 (lodash.restparam#3.6.1, lodash.assign#3.2.0)
├── ps-tree#1.1.0 (event-stream#3.3.4)
├── update-notifier#0.5.0 (is-npm#1.0.0, semver-diff#2.1.0, string-length#1.0.1, chalk#1.1.3, repeating#1.1.3, configstore#1.4.0, latest-version#1.0.1)
└── chokidar#1.6.1 (inherits#2.0.3, path-is-absolute#1.0.1, async-each#1.0.1, glob-parent#2.0.0, is-binary-path#1.0.1, is-glob#2.0.1, readdirp#2.1.0, anymatch#1.3.0)
jade#1.11.0 node_modules/jade
├── character-parser#1.2.1
├── void-elements#2.0.1
├── commander#2.6.0
├── mkdirp#0.5.1 (minimist#0.0.8)
├── jstransformer#0.0.2 (is-promise#2.1.0, promise#6.1.0)
├── constantinople#3.0.2 (acorn#2.7.0)
├── with#4.0.3 (acorn-globals#1.0.9, acorn#1.2.2)
├── clean-css#3.4.24 (commander#2.8.1, source-map#0.4.4)
├── transformers#2.1.0 (promise#2.0.0, css#1.0.8, uglify-js#2.2.5)
└── uglify-js#2.7.5 (uglify-to-browserify#1.0.2, async#0.2.10, yargs#3.10.0, source-map#0.5.6)
moment#2.17.1 node_modules/moment
execsql#0.0.3 node_modules/execsql
├── underscore#1.5.2
├── optimist#0.6.0 (wordwrap#0.0.3, minimist#0.0.10)
└── mysql#2.0.0-rc2 (require-all#0.0.3, bignumber.js#1.0.1)
node-hl7#0.1.3 node_modules/node-hl7
├── xmlbuilder#0.4.3
├── chai#1.4.2
├── xml2js#0.2.8 (sax#0.5.8)
└── socket.io#0.9.17 (base64id#0.1.0, policyfile#0.0.4, redis#0.7.3, socket.io-client#0.9.16)
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
├── body-parser#1.16.0
├── connect-busboy#0.0.2
├── cookie-parser#1.3.5
├── debug#2.2.0
├── execsql#0.0.3
├── express#4.12.4
├── gm#1.23.0
├── jade#1.11.0
├── jsonfile#2.4.0
├── module#0.0.1
├── moment#2.17.1
├── morgan#1.5.3
├── multer#0.1.6
├── node-hl7#0.1.3
├── node-mv#0.1.3
├── nodemon#1.11.0
├── periodic-task#0.1.2
├── request#2.79.0
├── serve-favicon#2.2.1
└── string#3.3.3
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 20.2M
-----> Launching...
Released v3
https://warm-coast-28316.herokuapp.com/ deployed to Heroku
Your log contents only show your most recent deploy of your application to Heroku. You need to retrieve the later log messages to see what happened.
I know this because every single Heroku web request generates a log entry, and your logs show none.
What you can do is this:
Visit your Heroku app. Get the error.
Run the heroku logs command to view the most recently logs (and errors).
If you want to keep your logs running while you are testing your app so you don't have to constantly repeat the heroku logs command, you can say:
$ heroku logs --tail
This will open a 'stream' of logs that you can continue viewing in real-time.
Related
I'm having some issues creating unit tests for my Puppet control repository.
I mostly work with roles and profiles with the following directory structure:
[root#puppet]# tree site
site
├── profile
│ ├── files
│ │ └── demo-website
│ │ └── index.html
│ └── manifests
│ ├── base.pp
│ ├── ci_runner.pp
│ ├── docker.pp
│ ├── gitlab.pp
│ ├── logrotate.pp
│ └── website.pp
├── role
│ └── manifests
│ ├── gitlab_server.pp
│ └── nginx_webserver.pp
Where do I need to place my spec files and what are the correct filenames?
I tried placing them here:
[root#puppet]# cat spec/classes/profile_ci_runner_spec.rb
require 'spec_helper'
describe 'profile::ci_runner' do
...
But I get an error:
Could not find class ::profile::ci_runner
The conventional place for a module's spec tests is in the module, with the spec/ directory in the module root. So site/profile/spec/classes/ci_runner_spec.rb, for example.
You could consider installing PDK, which can help you set up the structure and run tests, among other things.
I am trying to generate client code using k8s.io/code-generator.
These are the instructions that I am following: https://itnext.io/how-to-generate-client-codes-for-kubernetes-custom-resource-definitions-crd-b4b9907769ba
My question is, does my go module need to be present on a repository or can I simply run the generate-groups.sh script on a go module that is ONLY present on my local system and not on any repository?
I have already tried running it and from what I understand, there needs to be a repository having ALL the contents of my local go module. Is my understanding correct?
You CAN run kubernetes/code-generator's generate-groups.sh on a go module that is only present on your local system. Neither code-generator nor your module needs to be in your GOPATH.
Verification
Cloned kubernetes/code-generator into a new directory.
$HOME/somedir
├── code-generator
Created a project called myrepo and mocked it with content to resemble sample-controller. Did this in the same directory to keep it simple.
somedir
├── code-generator
└── myorg.com
└── myrepo # mock of sample-controller
├── go.mod
├── go.sum
└── pkg
└── apis
└── myorg
├── register.go
└── v1alpha1
├── doc.go
├── register.go
└── types.go
My go.mod looked like
module myorg.com/myrepo
go 1.14
require k8s.io/apimachinery v0.17.4
Ran generate-group.sh. The -h flag specifies which header file to use. The -o flag specifies the output base which is necessary here because we're not in GOPATH.
$HOME/somedir/code-generator/generate-groups.sh all myorg.com/myrepo/pkg/client myorg.com/myrepo/pkg/apis "myorg:v1alpha1" \
-h $HOME/somedir/code-generator/hack/boilerplate.go.txt \
-o $HOME/somedir
Confirmed code generated in correct locations
myrepo
├── go.mod
├── go.sum
└── pkg
├── apis
│ └── myorg
│ ├── register.go
│ └── v1alpha1
│ ├── doc.go
│ ├── register.go
│ ├── types.go
│ └── zz_generated.deepcopy.go
└── client
├── clientset
│ └── versioned
│ ├── clientset.go
│ ├── doc.go
│ ├── fake
│ ├── scheme
│ └── typed
├── informers
│ └── externalversions
│ ├── factory.go
│ ├── generic.go
│ ├── internalinterfaces
│ └── myorg
└── listers
└── myorg
└── v1alpha1
Sources
Go modules support https://github.com/kubernetes/code-generator/issues/57
Documentation or support for Go modules https://github.com/kubernetes/sample-controller/issues/47
In Drupal 7 I use
drush-patchfile
to automatically implements patches when installing/updating module via drush. But in DDEV I don't know how to extend existing drush with drush-patchfile
As you can see on https://bitbucket.org/davereid/drush-patchfile section Installation, I need to clone the repository into
~/.drush
directory and that will append it to existing drush.
On another project without DDEV, I've already done that with creating new docker image file
FROM wodby/drupal-php:7.1
USER root
RUN mkdir -p /home/www-data/.drush && chown -R www-data:www-data /home/www-data/;
RUN cd /home/www-data/.drush && git clone https://bitbucket.org/davereid/drush-patchfile.git \
&& echo "<?php \$options['patch-file'] = '/home/www-data/patches/patches.make';" \
> /home/www-data/.drush/drushrc.php;
USER wodby
But I'm not sure how to do that in DDEV container.
Do I need to create a new service based on drud/ddev-webserver or something else?
I've read documentation but not sure in what direction to go.
Based on #rfay comment, here solution that works for me (and with little modification can works for other projects).
I've cloned repo outside of docker container; for example, I've cloned into
$PROJECT_ROOT/docker/drush-patchfile
Create custom drushrc.php in the $PROJECT_ROOT/.esenca/patches folder (you can choose different folder)
<?php
# Location to the patch.make file. This should be location within docker container
$options['patch-file'] = '/var/www/html/.esenca/patches/patches.make';
Add following hooks into $PROJECT_ROOT/.ddev/config.yaml
hooks:
post-start:
# Copy drush-patchfile directory into /home/.drush
- exec: "ln -s -t /home/.drush/ /var/www/html/docker/drush-patchfile"
# Copy custom drushrc file.
- exec: "ln -s -t /home/.drush/ /var/www/html/.esenca/patches/drushrc.php"
Final project structure should looks like
.
├── .ddev
│ ├── config.yaml
│ ├── docker-compose.yaml
│ ├── .gitignore
│ └── import-db
├── docker
│ ├── drush-patchfile
│ │ ├── composer.json
│ │ ├── patchfile.drush.inc
│ │ ├── README.md
│ │ └── src
├── .esenca
│ └── patches
│ ├── drushrc.php
│ └── patches.make
├── public_html
│ ├── authorize.php
│ ├── CHANGELOG.txt
│ ├── COPYRIGHT.txt
│ ├── cron.php
│ ├── includes
│ ├── index.html
│ ├── index.php
│ ├── INSTALL.mysql.txt
│ ├── INSTALL.pgsql.txt
│ ├── install.php
│ ├── INSTALL.sqlite.txt
│ ├── INSTALL.txt
│ ├── LICENSE.txt
│ ├── MAINTAINERS.txt
│ ├── misc
│ ├── modules
│ ├── profiles
│ ├── README.txt
│ ├── robots.txt
│ ├── scripts
│ ├── sites
│ │ ├── all
│ │ ├── default
│ │ ├── example.sites.php
│ │ └── README.txt
│ ├── themes
│ ├── Under-Construction.gif
│ ├── update.php
│ ├── UPGRADE.txt
│ ├── web.config
│ └── xmlrpc.php
└── README.md
At the end start ddev envronment
ddev start
and now you can use drush-patchfile commands within web docker container.
You can ddev ssh and then sudo chown -R $(id -u) ~/.drush/ and then do whwatever you want in that directory (~/.drush is /home/.drush).
When you get it going and you want to do it repetitively for every start, you can encode the instructions you need using post-start hooks: https://ddev.readthedocs.io/en/latest/users/extending-commands/
Please follow up with the exact recipe you use, as it may help others. Thanks!
I have this directory.
.
├── animation
│ ├── animation-events
│ │ ├── app.js
│ │ ├── app.mustache.json
│ │ ├── create_view.sh
│ │ └── assets
│ │ └── dummy_character_sprite.png
│ └── change-frame
│ ├── app.js
│ ├── app.mustache.json
│ ├── create_view.sh
│ └── assets
│ └── dummy_character_sprite.png
├── app.css
├── app.mustache
├── bunch_of_functions.js
├── decorators.js
├── create_all_views.sh
└── displaying-a-static-image
├── app.js
├── app.mustache.json
├── create_view.sh
└── assets
└── piplup.png
I want for create_all_views.sh to execute all create_view.sh in the children directory. How can I achieve such thing?
As you are in Ubuntu, you have the GNU implementation of find,
which has the -execdir option,
and you can do like this:
find path/to/dir -name create_view.sh -execdir ./create_view.sh \;
That is,
for each create_view.sh file it finds in the directory tree,
it will execute ./create_view.sh in the directory of that file.
How can I add folder and subfolders of my libs to simplecov generate the coverage?
My SimpleCov Config
SimpleCov.start do
add_group 'Bot', 'app/bots'
add_group 'Bot', 'lib/bot'
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
add_group 'Helpers', 'app/helpers'
add_group 'Libraries', 'lib'
end
This is my lib tree
├── assets
├── bot
│ ├── base_bot_logic.rb
│ ├── bot_logic.rb
│ ├── core
│ │ ├── blacklist.rb
│ │ ├── bot_core.rb
│ │ ├── broadcast.rb
│ │ ├── emoji.rb
│ │ ├── profile.rb
│ │ ├── reply.rb
│ │ ├── setup.rb
│ │ ├── state_machine.rb
│ │ └── webview.rb
│ └── geoutils
│ └── geoutils.rb
├── estrutura.txt
├── solar
│ ├── api.rb
│ ├── assistido.rb
│ ├── atendimento.rb
│ └── validation
│ └── cpf.rb
├── solar.rb
└── tasks
7 directories, 18 files
But only two files are recognized by SimpleCov.
How I can add missing folders?
EDIT:
I add track_files '{app,lib}/**/*.rb' in my SimpleCov.start and it recognize mys files, but don't calculate the coverage rate.
Although I missed the party, I will answer
Getting started contains answer on your question:
If SimpleCov starts after your application code is already loaded (via
require), it won't be able to track your files and their coverage! The
SimpleCov.start must be issued before any of your application code is
required!
In this way, its correctly:
require 'simplecov'
require 'yourapp'
its NOT correctly:
require 'yourapp'
require 'simplecov'
track_files just includes files matched by this glob, whether or not they were explicitly required.