Correct path for rabbitmq Docker container in Windows - windows

I have a RabbitMQ Docker container in a docker-compose.yml file.
rabbit:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"
- "61613:61613"
- "15674:15674"
volumes:
- ./enabled_plugins:/etc/rabbitmq/enabled_plugins
labels:
- "traefik.enable=true"
- "traefik.docker.network=default"
- "traefik.ws.port=15674"
- "traefik.ws.frontend.rule=PathPrefixStrip:/stomp/"
- "traefik.web.port=15672"
- "traefik.web.frontend.rule=PathPrefixStrip:/rabbit/"
The problem is that when I do docker-compose up -d, there is an error.
$ docker-compose up -d
Removing deploji-server_rabbit_1
deploji-server_postgres_1 is up-to-date
Starting 820ca92c591a_deploji-server_server_1 ...
Recreating 563cd247aa16_deploji-server_rabbit_1 ...
deploji-server_traefik_1 is up-to-date
Recreating 563cd247aa16_deploji-server_rabbit_1 ... error
Starting 98268bf1b8a7_deploji-server_worker_1 ... done
ERROR: for 563cd247aa16_deploji-server_rabbit_1 Cannot start service rabbit: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Projects/deploji-server/enabled_plugins\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56aStarting 820ca92c591a_deploji-server_server_1 ... done
tmq/enabled_plugins\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: for rabbit Cannot start service rabbit: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Projects/deploji-server/enabled_plugins\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56a/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56a/merged/etc/rabbitmq/enabled_plugins\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Encountered errors while bringing up the project.
There seems to be no problems in Linux environment, only on Windows. I assume the path for enabled_plugins file is incorrect. I've tried changing the mapping to something like
./enabled_plugins:/c/rabbitmq
and the container seems to start, but the server is not responding, so I guess the plugins from the enabled_plugins file were not properly installed.
Whole docker-compose.yml file can be seen here: https://github.com/maxmeister/deploji-server/blob/master/docker-compose.yml
Any advice on how could I make it run okay on my Windows machine? Thanks in advance.

I would suggest following the docs:
There are several options if use short syntax:
SHORT SYNTAX Optionally specify a path on the host machine
(HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).
You can mount a relative path on the host, that expands relative to
the directory of the Compose configuration file being used. Relative
paths should always begin with . or ...
volumes:
# Just specify a path and let the Engine create a volume
- /var/lib/mysql
# Specify an absolute path mapping
- /opt/data:/var/lib/mysql
# Path on the host, relative to the Compose file
- ./cache:/tmp/cache
# User-relative path
- ~/configs:/etc/configs/:ro
# Named volume
- datavolume:/var/lib/mysql
Related question and answers

Related

Spring Boot app in Docker container not starting in Cloud Run after building successfully - cannot access jarfile

I've set up continuous deployment to Cloud Run from GitHub for my Spring Boot project, and while it's successfully building in Cloud Build, when I go over to Cloud Run, I get the following error under Creating Revision:
The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable.
When I go over to the Logs, I see the following errors:
2022-09-23 09:42:47.881 BST
Error: Unable to access jarfile /app/target/educity-manager-0.0.1-SNAPSHOT.jar
{
insertId: "632d7187000d739d29eb84ad"
labels: {5}
logName: "projects/educity-manager/logs/run.googleapis.com%2Fstderr"
receiveTimestamp: "2022-09-23T08:42:47.883252595Z"
resource: {2}
textPayload: "Error: Unable to access jarfile /app/target/educity-manager-0.0.1-SNAPSHOT.jar"
timestamp: "2022-09-23T08:42:47.881565Z"
}
2022-09-23 09:43:48.800 BST
run.googleapis.com
…ager/revisions/educity-manager-00011-fod
Ready condition status changed to False for Revision educity-manager-00011-fod with message: Deploying Revision.
{
insertId: "w6ptr6d20ve"
logName: "projects/educity-manager/logs/cloudaudit.googleapis.com%2Fsystem_event"
protoPayload: {
#type: "type.googleapis.com/google.cloud.audit.AuditLog"
resourceName: "namespaces/educity-manager/revisions/educity-manager-00011-fod"
response: {6}
serviceName: "run.googleapis.com"
status: {2}}
receiveTimestamp: "2022-09-23T08:43:49.631015104Z"
resource: {2}
severity: "ERROR"
timestamp: "2022-09-23T08:43:48.800371Z"
}
Dockerfile is as follows (and looking at the build log all of the commands in it completed successfully):
FROM openjdk:17-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
COPY . /app
ENTRYPOINT [ "java","-jar","/app/target/educity-manager-0.0.1-SNAPSHOT.jar" ]
I've read that Cloud Run defaults to exposing Port 8080, but just to be on the safe side I've put server.port=${PORT:8080} in my application.properties file (but it seems to make no difference one way or the other).
I have run into similar issues in the past. Usually, I am able to resolve this issue by:
specifying the port in the application itself (as you indicated in your post), and
exposing the required port in my dockerfile eg. EXPOSE 8080
Oh my good god I have done it. After two full days of digging, I realised that because I was doing it through github, my .gitignore file was excluding the /target folder containing the jar file, so Cloud Build never got the jar file mentioned in the Dockerfile.
I am going to have a cry and then go to the pub.

Service "elasticsearch" failed to build:Invalid reference format

Project Screenshot
I was working in a project in which i has to use docker,elastic search etc,i installed all necessary packages and mounted my github repo and i build it , and then this error pops us that Service elastic search failed to build :invalid reference format
The ELK_VERSION argument is not passed into the build context.
You have also a warning there mention that for you. Your compose file needs to like this:
version: "3.8"
services:
elasticsearch:
build:
args:
ELK_VERSION: "1.2.3"

Unable to install chromedriver on docker machine using Webdrivermanager

I am using webdrivermanager plugin by Boni Garcia for driver installation. When I use it for execution on my local and everything working fine but I face issues when I try to do the same via Jenkins. Details below:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.3.0</version>
</dependency>
Now when I try to execute the same maven project via Jenkins, I am facing issue. My slave machine is a docker machine.
At first, I tried webdrivermanager to take care of the chrome driver installation and I got error stating that binary not found.
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("start-maximized");
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver(options);
Error:
org.openqa.selenium.WebDriverException:
unknown error: cannot find Chrome binary
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Linux 3.10.0-862.14.4.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Then I tried using driver from within the framework. I saved the chromedriver file in a drivers folder within my framework and then tried to execute it, but still got an error (different error this time though)
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("start-maximized");
System.setProperty("webdriver.chrome.driver", "src/test/resources/drivers/chromedriver");
driver = new ChromeDriver(options);
Error:
Running TestSuite
/home/jenkins/workspace/Dental_EIEI_Angular/EIEI Test Jenkins/src/test/resources/drivers/chromedriver: /home/jenkins/workspace/Dental_EIEI_Angular/EIEI Test Jenkins/src/test/resources/drivers/chromedriver: cannot execute binary file
Apr 03, 2019 2:19:23 PM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126)
I was running into an issue which was something similar to what you are facing. The WebDriverException : unknown error: cannot find Chrome binary is because your framework is unable to find the chrome binary in jenkins. To set the binary using your code is not fissible because you should know the path of binary file. Instead of getting into that hassle, simply create a docker-compose.yml file to get your infra up and running to execute your tests.
version: "3"
services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub
ports:
- "4444:4444"
environment:
- GRID_BROWSER_TIMEOUT=30
chrome:
image: selenium/node-chrome
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
firefox:
image: selenium/node-firefox
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
then you can use docker-compose up -d to run your infra in detached mode. You also need to do some relevant changes in your code to access the selenium-hub server.
System.setProperty("webdriver.chrome.driver", "src//test//resources//driver//chromedriver");
ChromeOptions cap = new ChromeOptions();
cap.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
webDriver = new RemoteWebDriver(new URL("http://"+serverIP+":4444/wd/hub"), cap);
webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
where serverIP is localhost if you want to run the application in your local system or if you want to run it in jenkins then you need the IP address of the selenium-hub server which can be found by running docker inspect on jenkins

Cannot delete a Kafka topic in Windows

I have set the Zookeeper properties of "delete.topic.enable" to true. But I still cannot delete the topic. When I do mvn install or mvn test, I got following problems:
WARN Error processing kafka.log:type=LogManager,name=LogDirectoryOffline,logDirectory=C:\Users\extznq\AppData\Local\Temp\EH4Test7267133751803693562 (com.yammer.metrics.reporting.JmxReporter:397)
javax.management.MalformedObjectNameException: Invalid character ':' in value part of property
ERROR Error while deleting healthchecktopic1516638375589-0 in dir C:\Users\extznq\AppData\Local\Temp\EH4Test9083449671042580730. (kafka.server.LogDirFailureChannel:107)
java.io.IOException: Failed to rename log directory from C:\Users\{My-topic-path} to C:\Users\{My-topic-path}-0.0a40ae7410c2401aba0816891789c334-delete
at kafka.log.LogManager.asyncDelete(LogManager.scala:671)
at kafka.cluster.Partition$$anonfun$delete$1.apply(Partition.scala:178)
at kafka.cluster.Partition$$anonfun$delete$1.apply(Partition.scala:173)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:217)
at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:225)
at kafka.cluster.Partition.delete(Partition.scala:173)
at kafka.server.ReplicaManager.stopReplica(ReplicaManager.scala:341)
at kafka.server.ReplicaManager$$anonfun$stopReplicas$2.apply(ReplicaManager.scala:373)
at kafka.server.ReplicaManager$$anonfun$stopReplicas$2.apply(ReplicaManager.scala:371)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at kafka.server.ReplicaManager.stopReplicas(ReplicaManager.scala:371)
at kafka.server.KafkaApis.handleStopReplicaRequest(KafkaApis.scala:190)
at kafka.server.KafkaApis.handle(KafkaApis.scala:104)
at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:65)
at java.lang.Thread.run(Thread.java:745)
ERROR [Broker id=0] Ignoring stop replica (delete=true) for partition healthchecktopic1516728986980-0 due to storage exception (state.change.logger:107)
org.apache.kafka.common.errors.KafkaStorageException: Error while deleting healthchecktopic1516728986980-0 in dir C:\Users\AppData\Local\Temp\EH4Test7267133751803693562.
Caused by: java.io.IOException: Failed to rename log directory from C:\Users\AppData\Local\Temp\EH4Test7267133751803693562\healthchecktopic1516728986980-0 to C:\Users\AppData\Local\Temp\EH4Test7267133751803693562\healthchecktopic1516728986980-0.65fc6c32c44940e58c1a45bd2972523a-delete
at kafka.log.LogManager.asyncDelete(LogManager.scala:671)
I think the Warning is all right. But I do not know why I would get errors, although I run the Eclipse as administrator. Especially, the KafkaStorageException, I still have 50GB in my computer.
Environment:
Windows 10
Zookeeper 3.5.3-beta
Kafka 1.0.0
looks like you have an invalid character in the properties: Invalid character ':' in value part of property; also in the line below it seems that the placeholder you are using it is not replaced properly: C:\Users\{My-topic-path}
Furthermore there is an open issues related to file operation such as moving/delete in windows environment, I got the same problem upgrading from 0.10.2.1 to 1.1.0
This is the link to the issue: KAFKA-1194

Codedeploy-agent error when run in amazon linux instance

When I create a new deploy in AWSCodeDeploy with GitHub I receive this fail message:
Error CodeScriptFailed
Script Namescripts/stop_server.sh
MessageScript at specified location: scripts/stop_server.sh run as user ubuntu failed with exit code 1
Log TailLifecycleEvent - ApplicationStop
Script - scripts/stop_server.sh
[stderr]su: user ubuntu does not exist
But, my instance is an Amazon Linux Instance and don't have a ubuntu user, anybody know anything about this?
The script that a try to run is:
# scripts/stop_server.sh
#!/bin/bash
forever stop .
My appspec.yml file:
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user
hooks:
AfterInstall:
- location: scripts/install_dependencies.sh
timeout: 5
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 5
runas: root
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 5
runas: root
Codedeploy-agent version agent_version: OFFICIAL_1.0-1.1095_rpm
Application stop usually refers to appspec.yml in previous successful deployment archive. Either empty /opt/codedeploy-agent/deployment-archive/deployment-instructions/ or you may use BeforeInstall hook to execute stop script.
The code deploy create temporary application inside /opt/code-deploy/.... path. If the deployment fails normally it starts from the temporary directory next time. If you want to get rid of the error pointing by deployment, you should check the particular script file in the temporary directory and edit it.

Resources