Relation of dump.pm2 and ecosystem.json - pm2

i'm using pm2-windows-service to start PM2 as service.
I don't understand the relationship between dump.pm2 and ecosystem.json. It looks like they are all the pm2 boot config that will be used. But which would take precedence if both in dump.pm2 and ecosystem.json were defined?
Please tell me the answer . Thanks you.

ecosystem.json will have a higher priority than dump.pm2.
When there is no ecosystem.json file it will use dump.pm2 file. dump.pm2 will be generated when running the command : pm2 save.
It is more convenient to use the ecosystem.json because we just need to change the settings in the ecosystem.json. If we use dump.pm2, we need to run the app again (pm2 start ...) and then update the dump file with the command : pm2 save

Related

Libvirt generated profiles

I'm using apparmor as hardening layer for libvirt-qemu , everything is OK , but there is one thing that I can't solve systematically, let me explain :
When create a new qemu instance , profile is generated from /etc/apparmor.d/libvirt/TEMPLATE.qemu to a file with path /etc/apparmor.d/libvirt/libvirt-81303229-df4c-4b18-b33b-277bcda81b0f for example .
When instance is shut-off profile is unloaded from kernel by apparmor and it is OK as expected. But if i remove the instance definitively, i would expect that profile is removed also from filesystem, but it is not and still present in filesystem. After some time I have very big mess in libvirt instance profile files
Yes .. I can write a cron job what will be delete unnecessary libvirt profile files ... but ..is there some more clear solution , maybe builtin function of apparmor ?
Thanks
Are you using libvirt undefine to delete the stopped guest? It appears that virt-aa-helper should delete an undefined domain but I think it is a bug and you should file a ticket.
You can use the virt-aa-helper command directly to remove the files which is probably the safest as it should deal with the dependencies for you.
An example command is:
$ sudo /usr/lib/libvirt/virt-aa-helper -D -u libvirt-3c3d5aa2-f581-457d-b5ab-efbf9fdd4a6e
But it may be some edge case that they need to account for, where you can undefine a running instance to convert it to ephemeral. You would need to take care of that edge case.
Note: Because virt-aa-helper is intended to be run by libvirt you will have to use sudo with the command. If you do not it will silently fail and not remove the profile.

Clone Openshift application in scalable

I have an application in Openshift free plan with only one gear. I want to change it to scalabe and take usage of all of 3 free gears.
I read this blog post from openshift and I found that there is a way to do it. I should clone my current application to a new one as a scalable which will use the 2 remaining gears and then I will delete the original application. Thus, the new one will have 3 free gears.
The way that blog suggest is: rhc create-app <clone> --from-app <existing> --scaling
I have the following error: invalid option --from-app
Update
After running the command gem update rhc, I don't have the error above but...A new application with the given name has created with the same starting package (Python 2.7) just like the existing one, but all the files are missing. It actually create a blank application and not a clone of the existing.
Update 2
Here is the structure of the folder:
-.git
-.openshift
-wsgi
---static
---views
---application
---main.py
-requirements.txt
-setup.py
From what we've talked on IRC, your problem was around missing SSH configuration on Windows machine:
Creating application xxx ... done
Waiting for your DNS name to be available ...done
Setting deployment configuration ... done
No system SSH available. Please use the --ssh option to specify the path to your SSH executable, or install SSH.
I've double checked it, and it appears to be working without any problem.
The only requirement is to have the latest rhc client and putty or any other
SSH client. I'd recommend going through this tutorial once again and double-check everything to make sure everything is working properly.
Make sure you are using the newest version of the rhc gem with "gem update rhc" to make sure that you have access to that feature from the command line.
The --from-app will essentially do a 'rhc snapshot save & snapshot restore` (amoung other things) as you can see here from the source:
if from_app
say "Setting deployment configuration ... "
rest_app.configure({:auto_deploy => from_app.auto_deploy, :keep_deployments => from_app.keep_deployments , :deployment_branch => from_app.deployment_branch, :deployment_type => from_app.deployment_type})
success 'done'
snapshot_filename = temporary_snapshot_filename(from_app.name)
save_snapshot(from_app, snapshot_filename)
restore_snapshot(rest_app, snapshot_filename)
File.delete(snapshot_filename) if File.exist?(snapshot_filename)
paragraph { warn "The application '#{from_app.name}' has aliases set which were not copied. Please configure the aliases of your new application manually." } unless from_app.aliases.empty?
end
However this will not copy over anything in your $OPENSHIFT_DATA_DIR directory so if you're storing files there, you'll need to copy them over manually.

Supervisord on Fedora configuration error

I am trying to install supervisor on my Fedora 17, using this link as reference:
https://www.digitalocean.com/community/articles/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps
It works fine except one trivial problem (I believe).
A simple configuration for our script, saved at /etc/supervisor/conf.d/long_script.conf, would look like so (...)
My problem is, that I have only files/directories:
/etc/supervisord/
/etc/supervisord.conf
I have tried to create conf.d directory under /etc/supervisord/. I have put my config file into /etc/supervisord/conf.d/ and /etc/supervisord/ and also /etc/sueprvisor/.
Despite my effort when issuing command:
supervisortctl reread
I receive:
No config updates to processes
Anyone has a clue what I might be doing wrong? Thanks in advance.
(I'm on Fedora 20) If you look at /etc/supervisord.conf at the bottom you see
[include]
files = supervisord.d/*.ini
So on Fedora your configuration files should end in .ini instead of .conf. I had this same problem and running supervisorctl reread after this detects stuff
There is no need to create a folder specifically for your configuration file, you can specify its path with the -c /path/to/your/file or --configuration=/path/to/your/file option.
Source: http://supervisord.org/running.html

Composer could not find a composer.json file even when the file exists

I have installed Laravel and and I am playing around with it.
I am following the tutorial :-
http://geekanddummy.com/how-to-laravel-4-tutorial-part-3-using-external-libraries/
I need a new library and have added that in composer.json.
But when I run
php composer.phar update
I get the following message :-
Composer could not find a composer.json file in
What do I need to do to get this corrected..?
I'm the author of the tutorial you link to (hope our Laravel tutorial series is of some use, by the way). I can't quite tell from your answer whether you restored all the content of the original composer.json file when you created a new file of the same name...? You definitely shouldn't need to nuke the composer.json file and start again. As you probably know, that file contains all the Composer-based dependencies for your Laravel project, so you would of course lose significant functionality if you were to wipe it and leave anything out when you start again.
The error message looks to me like you're either in the wrong directory or it's a permissions problem with the composer.json file. It's too late to be certain now, but if you come across the problem again, try running:
chmod a+r composer.json
at the console/ssh shell before running composer update. This restores read permissions (for all users). You may also wish to check file ownership. (Both commands assume we're in a Unix/Linux system, so YMMV.)
Watch out also for instances where you're running a Composer command with the global parameter. This will cause an change that relates to wherever you've installed Composer, rather than the directory you're currently working in.
Note that you can also update using the --working-dir parameter, thus:
php composer.phar --working-dir=/path/to/laravel/project update
Hope this helps.
Rob
Deleting the existing composer.json after copying the content and then saving a new file with the same name works.
If your on windows (at least in my experience) you actually use just 'composer', not composer.phar/.json or any extension.
composer update
composer dump-autoload
This is all I need to type in to be able to access composer in my laravel directory.
i had the same issue, tried several many solutions that worked for others but not in my case.
then some-one told me to drop the 'php' and '.phar' from my command. i.e. directly use
composer update
composer create-project etc.etc.
and to my surprise it worked..
Occasionally, and for reasons that remain a bit vague, restarting the server seems to solve the issue. That step might be worth trying before making changes to file permissions.
Go to https://git-scm.com/download/win
Then download related version and run your composer command inside the git bash
Or else you can use vscode bash;
enter image description here

is it possible to start activemq with a configuration file that's not in one of the default locations?

All right all you activemq guru's out there...
Currently activemq require a configuration file before it runs. It appears from its debug output message:
$ ./activemq start -h
INFO: Using default configuration (you can configure options in one of these file: /etc/default/activemq /home/user_name/.activemqrc)
That you can only put it in one of those two locations. Anybody know if this is the case? Is there some command line parameter to specify its location?
Thanks!
-roger-
Yes, it is possible. Here are 3 possible answers.
If classpath is setup properly:
activemq start xbean:myconfig.xml
activemq start xbean:file:./conf/broker1.xml
Not using the classpath:
activemq start xbean:file:C:/ActiveMQ/conf/broker2.xml
reference:
http://activemq.apache.org/activemq-command-line-tools-reference.html
I have not been able to find the answer to this and I struggled with this myself for a while, but I've found a bit of a workaround. When you use bin/activemq create, you can create a runnable instance that will have its own bin, conf, and data directories. Then you have more control over that runnable insance and the .activemqrc becomes less important.
See this for detail on the create option : http://activemq.apache.org/unix-shell-script.html
Try this:
bin/activemq start xbean:/home/user/activemq.xml
Note that if the xml file includes other files like jetty.xml then it needs to be in that dir also.
If using a recent 5.6 SNAPSHOT you can set the env var ACTIVEMQ_CONF to point to the location where you have the config files
in the /bin/activemq script under # CONFIGURATION # For using instances, you can add or remove any file destinations you'd like.
Be very though since it ignores the others at the first occurrency of a file, read more here
Unix configuration
happy coding !