I installed Drupal syslog module and I want to make sure that syslog configuration is working correctly. But checking inside the web container, I don't know if syslogd is running, and I haven't found where the logs might be.
As Randy said, you can add the syslog daemon as a post-start hook in your config.yaml. We use it as follows:
hooks:
post-start:
- exec: sudo syslogd
- exec: printf "\n\n#Drupal logs\n#local0.* /var/log/drupal.log\n" | sudo tee -a /etc/syslog.conf
This starts syslogd and configures it to write everything in facility (I guess its called like that) "local0.*" to /var/log/drupal.log.
To see what's in there, simply ssh into DDEV (ddev ssh) and run tail -f /var/log/syslog.
After enabling the syslog module you need to go to admin/config/development/logging and select "LOG_LOCAL0" as syslog facility and set a syslog format.
You have to install syslogd in your web container by adding webimage_extra_packages: [inetutils-syslogd] to your config.yaml and then restart. This will add the necessary package.
After starting your project, you should ddev ssh and run syslogd. That will manually start syslogd. If you want this to always start up, you can add running syslogd to a post-start exec hook.
The logs from syslogd go into /var/log/syslog
It probably makes more sense to use a different syslogd server, so you could use one of the many syslog images on hub.docker.com as a third-party service in ddev, or you could run syslogd on your workstation, or you could also use something like https://www.papertrail.com/
Related
Edit: I've been asked to state a concrete problem I'm looking for a solution for:
I'm using Apache httpd on Mac.
I want to run a local web server on port 2784.
I want it to use ~/foo as the Web root.
I want to do this as a non-root user.
I'm looking for the config file and/or command-line options to accomplish this, like so:
$ httpd --foo 2784 --bar ~/foo
What is --foo and --bar in this case, or if an external config file is needed, what is in it?
I am exploring different options to use for the "local dev test" web serveer for my project, which only requires serving static HTML.
I would like to avoid requiring extra packages for running it, and on Mac, the built-in httpd seems so obvious...
But so far, I have not been able to get it to work by running it from the command-line. On GNU/Linux, I have been "cheating" and installing lighttpd, which can be run with a short bare-bones config.
Is there an example of a minimum required to run config for Apache httpd out there?
I would really like to know.
I'm working on a project using ddev and I don't know how to troubleshoot things because they're hidden in the containers they run in. For example, I've tried ddev logs but it doesn't give me enough information.
Use ddev list and ddev describe to get the general idea of what's going on, but then ddev logs is the first line of investigation. It gets the logs of the web container (both the nginx error log and the php-fpm error log, mixed together).
Extra approaches:
You could probably (temporarily) remove any custom nginx/php/mysql configuration that you might have added to the project in the .ddev folder, as those are common culprits.
Please make sure you're using the current docker images that match the ddev version you're using. I recommend deleting any "webimage" or "dbimage" lines in your .ddev/config.yaml.
ddev logs -f will "follow" the web logs, so you can see what happens when you hit a particular URL.
ddev logs -s db (or of course ddev logs -f -s db will show you the logs of the database container (MariaDB logs)
Use ddev ssh (for the web container) or ddev ssh -s db (for the db container) to actually go in there and look around. The most important logs are in /var/log/ and /var/log/nginx.
You can even use ddev logs when a container has crashed or stopped for some reason, and figure out what happened with it.
Don't forget the troubleshooting section in the docs.
everyone.
Is there a way to keep Guard running inside a docker container?
At this point, I have tried many different things but all seems to fail.
Originally I was running it bundle exec guard .... but since now I need to manage the Docker container with Docker Cloud I cannot specify anymore -i as option to the run command so with that approach Guard closes right after booting.
11:03:18 - INFO - Guard is now watching at '/usr/app'
11:03:19 - INFO - Bye bye...
I tried to run Guard programmatically from a ruby file as such
...
guardfile = <<-EOF
...
EOF
Guard.start(guardfile_contents: guardfile)
with the same outcome.
I have also tried to use directly the listen gem but in this case the changes to files are not picked up.
Now, I'm out of options. Any suggestions?
Thanks
If you cannot specify the -i option anymore, you can still get the same effect by disabling interation inside the Guardfile:
https://github.com/guard/guard/wiki/Guardfile-DSL---Configuring-Guard#interactor
with: interactor :off
I am trying to run cron job on Docker container. I have a running container (Fedora 20).
I have also installed cron packages in container and explicitly run the cron daemon.
I have also checked cron.deny file it is empty and there is no file called cron.allow under /etc/ directory.
Whenever I tried to set the cronjob by using crontab -e or trying to list the cron job using
crontab -l I am getting following error.
bash-4.2# crontab -l
You (root) are not allowed to access to (crontab) because of pam configuration.
bash-4.2# crontab -e
You (root) are not allowed to access to (crontab) because of pam configuration.
I also checked the /etc/pam.d/crond file it has following entry
bash-4.2# vi /etc/pam.d/crond
#
# The PAM configuration file for the cron daemon
#
#
# No PAM authentication called, auth modules not needed
account required pam_access.so
account include password-auth
session required pam_loginuid.so
session include password-auth
auth include password-auth
Has any one faced this issue? If yes could you please suggest me some pointer on this?
thanks in advance.
An LXC container is not a virtual machine. You'll need to explictly run the cron daemon in the foreground. Better still run cron from program like Supervisor or runit.
Reference: Docker documentation
Traditionally a Docker container runs a single process when it is
launched, for example an Apache daemon or a SSH server daemon. Often
though you want to run more than one process in a container. There are
a number of ways you can achieve this ranging from using a simple Bash
script as the value of your container's CMD instruction to installing
a process management tool.
In this example we're going to make use of the process management
tool, Supervisor, to manage multiple processes in our container. Using
Supervisor allows us to better control, manage, and restart the
processes we want to run. To demonstrate this we're going to install
and manage both an SSH daemon and an Apache daemon.
You can do:
ENTRYPOINT cron -f
although remember that you can only have one ENTRYPOINT.
From the docs:
There can only be one ENTRYPOINT in a Dockerfile. If you have more
than one ENTRYPOINT, then only the last one in the Dockerfile will
have an effect.
An ENTRYPOINT helps you to configure a container that you can run as
an executable. That is, when you specify an ENTRYPOINT, then the whole
container runs as if it was just that executable.
Just started using EC2, launched the instance with Amazon Linux AMI, installed my web app on it...and I thought I was ready to go.
I go to the public DNS they gave me for my instance and nothing happens. I get the Google Chrome "Oops" ...
After re-reading the doc I saw some notes that I need to launch the web server. By doing this:
sudo chkconfig httpd on
sudo service httpd start
But I can't seem to locate these files.
Any ideas what I am doing wrong or where those files are located? The closest I got was /etc but even if I try the command lines from there, I get the same errors.
Thanks for your help.
UPDATE
Here is an image of the security group I have for my instance. This is correct right?
Is it possible you don't have Apache/Tomcat installed? Check with:
rpm -q httpd
rpm -q tomcat5
If they are not installed, run:
sudo yum install httpd tomcat5
Which type of webapps(php/java/Ruby etc) you are trying to deploy? If it is php, where you are trying to put in apache directory? For example default root document location in apache is /var/www/html . If you put your webapp inside /var/www/html it should be available through direct url http://x.x.x.x/{nameofwebapp}