symfony 5.3 logfile could not be opened in append mode: Failed to open stream (docker) - docker

I have a rotating Logfile configured with monolog, which worked like a charm and suddenly I get error messages stating that the file cannot be created, when the frontend is calling my symfony backend, which runs in a alpine docker container.
Creating logfiles while running my phpunit tests is causing no trouble at all.
This is my monolog configuration, which didn't change:
monolog:
handlers:
frontend:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.frontend.log"
level: error
channels: [ frontend ]
max_files: 3
main:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [ "!event", "!frontend", "!deprecation" ]
max_files: 3
console:
type: console
process_psr_3_messages: false
channels: [ "!event", "!doctrine", "!console", "!frontend", "!deprecation" ]
What I did was disabling sessions, which should have no influence on whether the system is able to create a file for writing.
Why can my server no longer write logfiles?
My permissions for my log folder are increased to 777 and the server runs as "root" in it's container:
e9dffe459185:/var/www/var# ll
total 8
drwxrwxr-x 6 root root 192 Jul 22 15:07 ./
drwxr-xr-x 51 root root 1632 Jul 23 10:16 ../
drwxrwxr-x 4 root root 128 Jul 23 11:01 cache/
drwxrwxrwx 3 root root 96 Jul 23 11:02 log/

Looks like the problem was fixed with an update of monolog:
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading monolog/monolog (2.3.1 => 2.3.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downloading monolog/monolog (2.3.2)
- Upgrading monolog/monolog (2.3.1 => 2.3.2): Extracting archive
Looks like version 2.3.1 was buggy. Since the upgrade I don't have further problems.

Related

Rails does not start up due to LoadError (can't find file that exists)

I'm on an ubuntu 20.04
Had a rails application that used to run until last month.
But a certificate issue made me reinstall nginx and passenger and some dependencies.
However all rails commands (console, server, assets:precompile) are now failing with the following error
/home/deploy/mark_antony/shared/bundle/ruby/2.7.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': libffi.so.6: cannot open shared object file: No such file or directory - /home/deploy/mark_antony/shared/bundle/ruby/2.7.0/gems/ffi-1.13.1/lib/ffi_c.so (LoadError)
But when i check, everything seems perfectly fine.. the file does exist:
deploy#ubuntu-s-1vcpu:~/mark_antony/current$ cd /home/deploy/mark_antony/shared/bundle/ruby/2.7.0/gems/ffi-1.13.1/lib/
deploy#ubuntu-s-1vcpu:~/mark_antony/shared/bundle/ruby/2.7.0/gems/ffi-1.13.1/lib$ ll
total 476
drwxrwxr-x 3 deploy deploy 4096 Jan 7 19:08 ./
drwxrwxr-x 6 deploy deploy 4096 Jan 7 19:07 ../
drwxrwxr-x 4 deploy deploy 4096 Jan 7 19:07 ffi/
-rw-rw-r-- 1 deploy deploy 925 Jan 7 19:07 ffi.rb
-rwxr-xr-x 1 deploy deploy 467872 Jan 7 19:08 ffi_c.so*
Any idea on how to get the app working again?

Jenkins can't find artifacts

I have a jenkins running a job, after which I want it to "archive artifact", which is basically just get some files.
The Job clones a github and when ran, it generates some log files which I need.
The patter is:
logfiles/*
I added a command to list the directory to make sure the files are there, and indeed they are.
+ ls -la logfiles
total 24
drwxr-xr-x 2 root root 4096 Apr 22 23:23 .
drwxr-xr-x 8 root root 4096 Apr 22 23:23 ..
-rw-r--r-- 1 root root 0 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41.log
-rw-r--r-- 1 root root 1248 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_shortmsg.csv
-rw-r--r-- 1 root root 2521 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_stats.log
-rw-r--r-- 1 root root 8035 Apr 22 23:23 1461367410777_testuuid_61746144-3A3A-5555-4944-3D5343414C41_trace_msg.log
Archiving artifacts
ERROR: No artifacts found that match the file pattern "logfiles/*". Configuration error?
ERROR: ‘logfiles/*’ doesn’t match anything, but ‘*’ does. Perhaps that’s what you mean?
Build step 'Archive the artifacts' changed build result to FAILURE
I don't really understand why they are not found.
Hope someone can help!
Thanks!
I finally found my problem. I had configured the job to do the git clone. But for some reason I also added the cloning on the build steps... once i removed that jenkins started getting the files properly.
I would still like to understand why this would happen...
Thanks to all

Buck build failing for "events-logs" Gerrit plugin (jar)

I am trying to build Gerrit plugin "events-log" jar ( https://gerrit.googlesource.com/plugins/events-log) via Buck build, but its failing with below error:
root#jenkins-test:~/events-log# ll
drwxr-xr-x 7 root root 4096 Jun 29 13:25 ./
drwxrwxr-x 24 root root 4096 Jun 29 13:22 ../
-rw-r--r-- 1 root root 1017 Jun 29 12:57 BUCK
-rw-r--r-- 1 root root 173 Jun 29 12:57 .buckconfig
drwxr-xr-x 3 root root 4096 Jun 29 13:25 .buckd/
drwxr-xr-x 6 root root 4096 Jun 29 13:05 buck-out/
drwxr-xr-x 8 root root 4096 Jun 29 13:27 .git/
-rw-r--r-- 1 root root 146 Jun 29 12:57 .gitignore
drwxr-xr-x 5 root root 4096 Jun 29 12:57 lib/
drwxr-xr-x 4 root root 4096 Jun 29 12:57 src/
root#jenkins-test:~/events-log# /root/buck/bin/buck build events-log:events-
log
Using buckd.
BUILD FAILED: No build file at events-log/BUCK when resolving target
//events-log:events-log.
Can somebody please tell how to fix it and build the jar.
Thanks
I think I've finally figured it out ...
What I wound up doing is checking out Gerrit and building the events-log plugin in the Gerrit tree.
git clone https://gerrit.googlesource.com/gerrit
cd gerrit
git co v2.11.2
git submodule init
git submodule update
git clone https://gerrit.googlesource.com/plugins/events-log plugins/events-log
buck build plugins/events-log
I'm pretty sure you just want /root/buck/bin/buck build //:events-log. See http://buckbuild.com/concept/build_target.html
Eventually I found src/main/resources/Documentation/build.md, with which I finally succeeded in building events-log:
git clone https://gerrit.googlesource.com/plugins/events-log
git clone https://gerrit.googlesource.com/bucklets
cd events-log
git checkout stable-2.12
ln -s ../bucklets .
ln -s bucklets/buckversion .buckversion
ln -s bucklets/watchmanconfig .watchmanconfig
buck build plugin
This builds buck-out/gen/events-log.jar.
If the version is 2.14 or later, please use bazle to build
And I also try to build v2.13 with buck, you need to modify gerrit_plugin.bucklet which is under bucklets folder
Old content:
target_suffix = ''):
from multiprocessing import cpu_count
from os import path,getcwd
New content:
target_suffix = ''):
with allow_unsafe_import():
from multiprocessing import cpu_count
from os import path,getcwd
Then execute "buck build plugin
Out put:
ruhu#CCM-P700:~/tools/events-log$ buck build plugin
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1-sources.jar
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar
Download http://repo1.maven.org/maven2/com/google/gerrit/gerrit-plugin-api/2.13/gerrit-plugin-api-2.13.jar
Parsing buck files: finished in 1.3 sec (100%)
Creating action graph: finished in 1.6 sec (100%)
Building: finished in 03:47.3 min (100%) 19/19 jobs, 19 updated, 94.7% cache mis
Total time: 03:50.3 min

Xcode 6 Code Coverage, no GDCA files "cannot open: No such file or directory"

I am trying to generate GDCA files using gcov in XCode, and have been using BubbleFoundry and this post as guides.
I have a separate test target created, which prints a bunch of lines when done like:
profiling: /Users/me/Library/Developer/Xcode/DerivedData/
MyProject-HASH/Build/Intermediates/MyProject.build/Debug-iphoneos/
MyProject Tests.build/Objects-normal/
armv7/mysource.gcda: cannot open: No such file or directory
After trying the instructions in both posts I tried setting up CoverStory, which resulted in the same error message.
My permissions in that directory:
8 -rwxrwxr-x 1 me staff 474 Nov 5 21:54 mysource.d
8 -rwxrwxr-x 1 me staff 220 Nov 5 21:54 mysource.dia
144 -rwxrwxr-x 1 me staff 71136 Nov 5 21:54 mysource.gcno
296 -rwxrwxr-x 1 me staff 148752 Nov 5 21:54 mysource.o
I previously tried running the permissions script from BubbleFoundy, but I still get the cannot open error (a.k.a. gdca files not written).
Apparently, I was generating GCDA files to the phone, which weren't being found. I fixed this by manual deleting all the directories in /Users/me/Library/Developer/Xcode/DerivedData/MyProject-HASH/Build/Intermediates/MyProject.build/ and then rerunning tests in the simulator.

Why is capistrano using git clone always

I have some basic issues with capistrano deployment. First of all, I need to know whether capistrano is using git clone even for the second or third when the git repo is already existing. Is there any issue if it uses git pull? I have added set :deploy_via, :remote_cache in my capfile. I am asking this because I tried adding a new file in the path in the server, and not in the git repo as it was a server specific file. The next time I deployed using capistrano, the file disappeared. It seems like capistrano is using git clone even when a git repo is already created. Why cant capistrano use git pull to update the code?
Capistrano creates a new subdirectory in realeases for each release like this
horse:releases xxx$ ls -lart
total 0
drwxrwxr-x 22 xxx staff 748 Jun 26 20:08 20120626180809
drwxrwxr-x 22 xxx staff 748 Jun 26 20:11 20120626181103
drwxrwxr-x 22 xxx staff 748 Jun 26 20:29 20120626182908
drwxrwxr-x 22 xxx staff 748 Jun 26 20:34 20120626183442
drwxrwxr-x 22 xxx staff 748 Jun 26 20:35 20120626183525
drwxrwxr-x 8 xxx staff 272 Jun 27 13:11 .
drwxrwxr-x 22 xxx staff 748 Jun 27 13:11 20120627111102
drwxrwxr-x 5 xxx staff 170 Jun 27 13:11 ..
and then simply sets a symlink to the current release like this
horse:deployed xxx$ ls -lart
total 8
drwxrwxr-x 4 xxx staff 136 Jun 26 19:51 ..
drwxrwxr-x 7 xxx staff 238 Jun 26 20:22 shared
drwxrwxr-x 8 xxx staff 272 Jun 27 13:11 releases
lrwxrwxr-x 1 xxx staff 70 Jun 27 13:11 current -> /Users/xxx/RailsDeployment/server/deployed/releases/20120627111102
This way, rollback of the deployment on the server is really easy as you just have to change the symlink back to the last (working) deployment, but as a new complete subdir is created each time it makes sense using git clone instead of git pull.
If you want to have server-specific files, you have to add a capistrano deploy task to your config/deploy.rb file to copy it from somewhere else outside the app directory (typically the shared subfolder). The reason for this is that the deployment should be fully automatic and document all necessary steps in an automated procedure, and not depend on files on the server that were put there manually as this is the first step to a snowflake server. So, if you need a file that is not part of your git repository, as typically something containing production passwords, you need to change config/deploy.rb to copy this file to where you need it. To see how to do this look at the copy_db_credentials tasks in my deploy.rb:
namespace :deploy do
desc "cause Passenger to initiate a restart"
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Copies database credentials"
task :copy_db_credentials do
run "cp #{shared_path}/credentials/database.yml #{current_path}/config/database.yml"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
end
end
after :deploy, "deploy:copy_db_credentials"
after "deploy:update_code", :bundle_install
desc "install the necessary prerequisites"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end

Resources