Add a virtual host dynamically in ejabberd - hosting

Is it possible to add a virtual host programmatically to ejabberd, without manually editing ejabberd.cfg and restart the server?
I see there are many new features released in latest ejabberd 19.* Like rest APIs, is it plausible to dynamically add virtual via REST APIs.

I see there are many new features released in latest ejabberd 19.* Like rest APIs, is it plausible to dynamically add virtual via REST APIs.
I don't see any new command to execute to add a new host.
Is it possible to add a virtual host programmatically to ejabberd, without manually editing ejabberd.cfg and restart the server?
Well, you can edit configuration file programmatically. You probably will prefer to put the hosts option in another file. Example:
In ejabberd.yml
include_config_file: /etc/ejabberd/hosts.yml
# hosts
# - example.org
...
In the new file hosts.yml put:
hosts:
- example.org
And now you can add new hosts to that config file, and reload all it:
$ echo " - example.net" >> /etc/ejabberd/hosts.yml
$ ejabberdctl reload_config

Related

moving a command to a different host template using icinga director

I have Icinga2 installed with icingaweb2 on Ubuntu 19.10 and I have Icinga director Installed for the configuration which is really awesome.
I created some command and attached them to linux-agent host template.
that was a mistake cause I added more servers that don't need these new commands.
so I created a new host template called my-linux-agent as a duplicate of linux-agent and now I want to move all my custom commands to the new host template and I can't find any way to do that.
versions:
Icinga2: 2.10.5
IcingaWeb2: 2.7.1
thanks
so i couldn't find a way to move the command to a different host directly
but you can easily duplicate the command to a different host and remove the previous one using the following simple steps:
open the relevant command
click on duplicate to duplicate the command
choose the relevant host and click save
open the previous command and delete it

Google cloud app engine - How to edit code using SSH and debug-mode

I am trying to debug an application I have deployed to google cloud app engine. Reading the docs, I figured out that in order to do so I have to enter the debug mode using
gcloud app --project [Project ID] instances enable-debug
afterwards I am able to SSH into my instance and access root. Now I would like to edit some of the files. However, trying to use vim or nano does not seem to work.
Is there a way to edit those files without re-deploying the entire app?
Once you SSH into the App Engine instance and open a shell into the Docker container, you'll need to download the package list before installing nano or vim:
apt-get update && apt-get install nano
Then you can edit your app's files (which are in /app):
nano composer.json
The deployed app runs live code. It is not generally feasible to edit it. Moreover, changes made to the running container are not permanent; in fact they and are lost at the first re-start.
You may find some information on the Debugging an Instance page.
Unrelated to the above, an actual command-line editor is offered in the cloud shell.

How to install additional software on a Netkit virtual machine?

I'm trying to use Netkit to test some of my C applications. In order to do so, I need to have gcc installed on my virtual machines. So I'm trying to install it following the instructions in the wiki. The second thing to do would be this:
Once vm has started, configure a name server inside its resolv.conf file
Here's what I find inside /etc/resolv.conf of the virtual machine:
#domain local.domain.nam
#nameserver w.x.y.z
#search suffix.for.unqualified.names
What should I write there? How to configure a name server? I tried to copy the resolv.conf of my host but it doesn't work.
If I try to run apt-get update here's the output I get:
You can look at /etc/resolv.conf on the host and add the nameserver lines found there to the guest file. Or you can use third-party recursive name servers. Here are some publicly accessible servers:
Google
Verisign
Note that Debian's APT configuration apparently contains unstable/sid repositories (based on the …/unstable/… part in the URLs). If the VM image was created a long time ago, this will make updates and installing additional software very difficult because the unstable/sid has evolved considerably since then, and upgrades for historic unstable to current versions does not always work.

Laravel Homestead vhost configuration

I am using Laravel homestead. For a project I need a special vhost configuration, where should I define this?
You add a new folder mapping into the "sites" block of Homestead.yml, like so:
- map: myapp.com
to: /home/vagrant/Code/myapp/public
That's all there is to adding a new vhost. To modify it, edit the appropriate file in /etc/nginx/sites-available. In the above case, this would be /etc/nginx/sites-available/myapp.com
See here for example customization of a newly added vhost. Note that the quick tip linked here uses Homestead Improved, a slightly enhanced version of Homestead, as described here.
More Homestead related posts can be found on our site via the Homestead tag.
I have been looking for a solution for customizing nginx vhosts. You want to do it in provisioning, or better: after provisioning otherwise Homestead will overwrite any changes you have done manually to the vhost files.
One solution is the one I found here:
https://laracasts.com/discuss/channels/requests/homestead-provision-deletes-custom-nginx-settings
Basically you create configuration files in a folder in the host machine, map that extra folder to the vagrant machine, then in your after.sh file (which is run by homestead after the normal provisioning is finished) you just copy all of them to nginx's sites_available folder.

How to setup Pydevd remote debugging with Heroku

According to this answer I am required to copy the pycharm-debug.egg file to my server, how do I accomplish this with a Heroku app so that I can remotely debug it using Pycharm?
Heroku doesn't expose the File system it uses for running web dyno to users. Means you can't copy the file to the server via ssh.
So, you can do this by following 2 ways:
The best possible way to do this, is by adding this egg file into requirements, so that during deployment it gets installed into the environment hence automatically added to python path. But this would require the package to be pip indexed
Or, Commit this file in your code base, hence when you deploy the file reaches the server.
Also, in the settings file of your project if using django , add this file to python path:
import sys
sys.path.append(relative/path/to/file)

Resources