I have a .Net core 5.0 application that uses the Serilog console sink to log. A part of the application starts a Prometheus metrics endpoint, this part is not integrated with Serilog and prints also to console.
When running as a docker both serilog and the endpoint prints to console.
When I install as a systemd service in ubuntu 20.04 LTS I see only the Prometheus logs, no Serilog.
app.service
[Unit]
Description=App1
Wants=network-online.target
After=network-online.target
[Service]
User=appuser
Group=appuser
WorkingDirectory=/usr/local/bin/app
EnvironmentFile=/usr/local/bin/app/app.env
ExecStart=dotnet /usr/local/bin/app/app.dll
Restart=always
[Install]
WantedBy=multi-user.target
Running journalctl -f -u app shows only the Prometheus logs. Is there a way to configure serilog to work with systemd?
Configuration error, the application was still trying to log to file. Once that was fixed serilog console logging shows up in systemd journal just fine.
Related
Today, I was trying to run the web console of airflow port other than 8080 like 80, 8090 but every time I was mentioning a different port in airflow.cfg and re-initialize the airflow and run airflow webserver -D
But every time the web console was running at port 8080 can anyone help or encountered this issue?
You need to change the port on airflow.cfg after you save the file, you shall run airflow db init and start airflow webserver again airflow webserver -D
If you are using docker image that will be different. You need change you docker-compose.yaml file
I am running a gcloud composer command from behind a proxy how do I set it to ignore https.
gcloud composer environments run $project --location $location list_dags
Unable to connect to the server: x509: cannot validate certificate for X.X.X.X because it doesn't contain any IP SANs
Up to current versions of Cloud Composer (1.9.0 at the time of writing), the gcloud composer environments run command works by connecting to the Kubernetes master of your environment's GKE cluster. The error means there is something is potentially wrong with the configuration given to you by the GKE API, or there is something intercepting your traffic (like a non-transparent proxy on a corporate network). You should verify that you can connect to the Kubernetes master using kubectl and resolve any issues with that before trying to use the Composer command.
To connect using kubectl, obtain cluster credentials and then try issuing a few commands:
gcloud container clusters get-credentials --zone=$Z $COMPOSER_CLUSTER_NAME
kubectl get pods
To answer your question directly, you can use --insecure-skip-tls-verify can fix your issue if you use kubectl, but this option cannot be passed to gcloud composer.
NOTE: MOVED here from SuperUser, where it didn't generate any response.
I have a application built on the latest .NET Core 3 which was released this week. I am having a problem while running under WSL with Ubuntu 18.04 LTS. Problem is an exception opening up RabbitMQ communication:
connection refused 127.0.0.1:5672
Port 5672 is a RabbitMQ instance running under Docker on the Windows side. The same .NET Core 3.0 app connects to the port and functions fine running under Windows that WSL2 Ubuntu is failing.
Do I need to configure WSL2 in some way to open that port to Ubuntu?
I can ping localhost and 127.0.0.1 under ubuntu
netstat -a under ubuntu doesn't return much and nothing about 5672/RabbitMQ
on Windows/powershell 'GetProcess -Id (GetNetTCPConnection -LocalPort 5672).OwningProcess' makes sense and returns docker...
.NET not installed but the application was built with 'dotnet publish -r ubuntu.16.04-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed'
The code opening RabbitMQ as requested.
public MessagesManager( string channelname, string host = "localhost" )
{
// real code passes username/pwd
var factory = new ConnectionFactory() { HostName = host };
_connectionMQ = factory.CreateConnection();
I have installed docker on windows , when I try to run hello-world for testing on docker. I get following error
Unable to find image
My computer is using proxy server for communication. I need to configure that server in the docker. I know proxy server address and port. Where I need to update this setting. I tried using https://docs.docker.com/network/proxy/#set-the-environment-variables-manually.
It is not working.
Try setting the proxy. Right click on the docker icon in system tray, go to settings, proxy and add the below settings:
"HTTPS_PROXY=http://<username>:<password>#<host>:<port>"
If you are looking to set a proxy on Linux, see here
The answer of Alexandre Mélard at question Cannot download Docker images behind a proxy works, here is the simplified version:
Find out the systemd script or init.d script path of the docker service by running:service docker status or systemctl status docker, for example in Ubuntu16.04 it's at /lib/systemd/system/docker.service
Edit the script for example sudo vim /lib/systemd/system/docker.service by adding the following in the [Service] section:
Environment="HTTP_PROXY=http://<proxy_host>:<port>"
Environment="HTTPS_PROXY=http://<proxy_host>:<port>"
Environment="NO_PROXY=<no_proxy_host_or_ip>,<e.g.:172.10.10.10>"
Reload and restart the daemon: sudo systemctl daemon-reload && sudo systemctl restart docker or sudo service docker restart
Verify: docker info | grep -i proxy should show something like:
HTTP Proxy: http://10.10.10.10:3128
HTTPS Proxy: http://10.10.10.10:3128
This adds the proxy for docker pull, which is the problem of the question. If for running or building docker a proxy is needed, either configure ~/.docker/config as the official docs explained, or change Dockerfile so there is proxy inside the container.
I had the same problem on a windows server and solved the problem by setting the environment variable HTTP_PROXY on powershell:
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://username:password#proxy:port/", [EnvironmentVariableTarget]::Machine)
And then restarting docker:
Restart-Service docker
More information at Microsoft official proxy-configuration guide.
Note: The error returned when pulling image, with version 19.03.5, was connection refused.
I have installed docker engine v1.12.3 on Ubuntu 14.04 LTS and since after the following changes to enable Remote API, I'm not able to pull or run any of the docker images,
Added DOCKER_OPTS="-H tcp://127.0.0.1:2375" in /etc/default/docker.
/etc/init.d/docker start.
Following is the error received,
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Note: I have added login in user to the docker group
If you configure the docker daemon to listen to a TCP socket (as you do), you should use the -H command line option with the docker command to point it to that socket instead of the default Unix socket.
#mustaccio is correct. The docker command defaults to using a unix socket normally at /var/run/docker.sock. You can either make your options setup like:
DOCKER_OPTS="-H tcp://127.0.0.1:2375" -H unix:///var/run/docker.sock" and restart, or always use docker -H tcp://127.0.0.1:2375 whenever you interact with the host from the command line.
The only good scenario I've seen for removing the socket is pure user security. If your Docker host is TLS enabled, you can ensure only authorized people are accessing the host by signed certificates, not just people with access to the system.