crohr / pkgr

Package any app into deb or rpm packages, using heroku buildpacks
http://crohr.me/pkgr/
MIT License
590 stars 66 forks source link

Application log files are not written #138

Closed basiszwo closed 6 years ago

basiszwo commented 6 years ago

I am using the latest version of pkgr to build my rails 5.1 application on an Ubuntu 17.10 machine.

Everything works fine except that there are no application logs. There are none in the log directory of the application, nor are there any in /var/log/APP-NAME.

Other log files I create for services I have in my application are there but not the rails log.

I can view the log by using journalctl but it would be nice to have it in a file as I want to send it to some logging service.

According to @crohr the latest master includes a fix for this. I did install with

gem build pkgr.gemspec
gem install pkgr-1.5.1.gem

Unfortunately building my app then doesn't work any more.

I receive the following error:

-----> Running hook: "/tmp/before_hook20171207-6470-1pcsin2.sh"
       fatal: ambiguous argument 'head': unknown revision or path not in the working tree.
       Use '--' to separate paths from revisions, like this:
       'git <command> [<revision>...] -- [<file>...]'
-----> Ruby app
-----> Compiling Ruby/Rails
sh: 1: /: Permission denied
sh: 10: /tmp/bundler/home/deploy-as-your-home-directory-temporarily.-ruby-2.4.2

Heroku recommends you use the latest supported Ruby version listed here:
  https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

For more information on syntax for declaring a Ruby version see:
  https://devcenter.heroku.com/articles/ruby-versions

Debug InformationCommand: set: not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403 Forbidden
sh: 1: -is-not-writable.-Bundler-will-use-: not found
 !
 !     An error occurred while installing `/`-is-not-writable.-Bundler-will-use-`/tmp/bundler/home/deploy'-as-your-home-directory-temporarily.-ruby-2.4.2
 !
 !     Heroku recommends you use the latest supported Ruby version listed here:
 !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
 !
 !     For more information on syntax for declaring a Ruby version see:
 !     https://devcenter.heroku.com/articles/ruby-versions
 !
 !
 !     Debug InformationCommand: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/`/`-is-not-writable.-Bundler-will-use-`/tmp/bundler/home/deploy'-as-your-home-directory-temporarily.-ruby-2.4.2.tgz -s -o - | tar zxf - ' failed unexpectedly:
 !     bash: -c: line 0: unexpected EOF while looking for matching ``'
 !     bash: -c: line 1: syntax error: unexpected end of file
 !
     ! ERROR: compile failed

My questions are:

Thank you!

crohr commented 6 years ago

@basiszwo on systemd distributions, the only way to see your logs are though the journalctl command line. You could choose to manually configure your Rails app to log to a specific log file, but by default everything gets logged to STDOUT (though the inclusion of the rails_12factor plugin), and as such is managed by systemd.

The changes in master relate to the fact that the logs command is now smarter, in that it can apply journald flags to filter on specific processes (e.g. my-app logs web).

Regarding your last issue, I believe you are running pkgr as root? Try with a non-privileged user if you can