Stopping OrientDB service fails, ETL import not possible - docker

My goal is to import data from CSV-files into OrientDB.
I use the OrientDB 2.2.22 Docker image.
When I try to execute the /orientdb/bin/oetl.sh config.json script within Docker, I get the error: "Can not open storage it is acquired by other process".
I guess this is, because the OrientDB - service is still running. But, if I try to stop it i get the next error.
./orientdb.sh stop
./orientdb.sh: return: line 70: Illegal number: root
or
./orientdb.sh status
./orientdb.sh: return: line 89: Illegal number: root
The only way for to use the ./oetl.sh script is to stop the Docker instance and restart it in the interactive mode running the shell, but this is awkward because to use the "OrientDB Studio" I have to stop docker again and start it in the normal mode.

As Roberto Franchini mentioned above setting the dbURL parameter in the Loader to use a remote URL fixed the first issue "Can not open storage it is acquired by other process".
The issues with the .orientdb.sh still exists, but with the remote-URL approach I don't need to shutdown and restart the service anymore.

Related

Fail Connect to Running Phoenix Applications with IEx Remote Shell at Docker

Im deploy phx app using docker, running --remsh command from within the same container.
But it return could not contact remote node.
Anybody know the solution ?
Here is the snapshot
You seem to start the application as :nonode#nohost. To connect to it, you should have it started with either a short or fully qualified name.
mix release.init creates rel folder with two template files in it. Check env.sh.eex and make sure you start a release with a short name given. This should work:
export RELEASE_DISTRIBUTION=sname
export RELEASE_NODE=<%= #release.name %>
Sidenote: please post everything as plain text, not as images.
There is a problem in your command, please use --cookie instead of -cookie

fail2ban won't start using nextcloud.log with jail

I have nextcloud installed and working fine in a docker but want to have fail2ban monitor the log files for brute force attempts. I know nextcloud has it's own baked in but it just throttles the log in attempts and I would like to all out ban them (I also have this problem with other containers as well). The docker-compose is set to create the nextcloud.log file to /mnt/nextcloud/log/nextcloud.log. I followed this guide to create the jail
https://www.c-rieger.de/nextcloud-installation-guide-ubuntu/#c06
Fail2ban is running on the host machine however, fail2ban fails to start with:
[447]: ERROR Failed during configuration: Have not found any log file for nextcloud jail
[447]: ERROR Async configuration of server failed
Thinking it was simply a permission issue, I chowned everything to root and tried to start again but still the service won't start. What am I doing wrong?
Thanks for the help!
The docker-compose is set to create the nextcloud.log file to /mnt/nextcloud/log/nextcloud.log
Be sure this file really exists and your jail.local has correct entry logpath:
[nextcloud]
...
logpath = /mnt/nextcloud/log/nextcloud.log
You can also check resulting config using dump:
fail2ban-client -d | grep 'nextcloud.*logpath'
But I'm still not sure the error message you provide was throwed by fail2ban, because its error messages look different, see https://github.com/fail2ban/fail2ban/commit/27947407bc7910f0f50972113218ebc73c4a22c7
It should be something like:
-have not found a log file for nextcloud log
+Have not found any log file for nextcloud jail

Starting Docker daemon with sysVinit

at the moment I work with ARM64 based Debian Images and docker.
I want to automate the docker daemon on boot so we do not have to start it manually. But the Images do not use the systemd but good old sysVinit.
So I though "quite easy - simple an init script with command "dockerd" (or start-stop-daemon and dockerd as Argument". But no - does not work. The command "dockerd -v" works fine when booting (checked by pipe output to log file). But when execute "dockerd" without an Argument - so simple start daemon - nothing happen - no error no warning nothing is piped to log file.
So my question is - are there any other processes Need to be started or configurations need to be done before this dockerd command can be started?
When boot is finished and i do SSH to device and manually do "dockerd" all works fine.
just for close this question by myself :D
I noticed that in sysVinit system when starting the init-scripts the path variable did not exist (maybe because root starting the processes). #
So in my script i just added the path variable and set path to folder of dockerd and everything worked well! :D

Docker - Handling multiple services in a single container

I would like to start two different services in my Docker container and exit the container as soon as one of them exits. I looked at supervisor, but I can't find how to get it to quit as soon as one of the managed applications exits. It tries to restart them up to three times, as is the standard setting and then just sits there doing nothing. Is supervisor able to do this or is there any other tool for this? A bonus would be if there also was a way to let both managed programs write to stdout, tagged with their application name, e.g.:
[Program 1] Some output
[Program 2] Some other output
[Program 1] Output again
Since you asked if there was another tool... we designed and wrote a powerful replacement for supervisord that is designed specifically for Docker. It automatically terminates when all applications quit, as well as has special service settings to control this behavior, plus will redirect stdout with tagged syslog-compatible output lines as well. It's open source, and being used in production.
Here is a quick start for Docker: http://garywiz.github.io/chaperone/guide/chap-docker-simple.html
There is also a complete set of tested base-images which are a good example at: https://github.com/garywiz/chaperone-docker, but these might be overkill and the earlier quickstart may do the trick.
I found solutions to both of my requirements by reading through the docs some more.
Exit supervisord on application exit
This can be achieved by using a custom eventlistener. I had to add the following segment into my supervisord configuration file:
[eventlistener:shutdownevent]
command=/shutdownhandler.sh
events=PROCESS_STATE_EXITED
supervisord will start the referenced script and upon the given event being triggered (PROCESS_STATE_EXITED is triggered after the exit of one of the managed programs and it not restarting automatically) will send a line containing data about the event on the scripts stdin.
The referenced shutdownhandler-script contains:
#!/bin/bash
while :
do
echo -en "READY\n"
read line
kill $(cat /supervisord.pid)
echo -en "RESULT 2\nOK"
done
The script has to indicate being ready by sending "READY\n" on its stdout, after which it may receive an event data line on its stdin. For my use case upon receival of a line (meaning one of the managed programs has exited), a SIGTERM is sent to the supervisord process being found by the pid it leaves in its pid file (situated in the root directory by default). For technical completeness, I also included a positive answer for the eventlistener, though that one should never matter.
Tagged output on stdout
I did this by simply starting a tail process in the background before starting supervisord, tailing the programs output log and piping the lines through ts (from the moreutils package) to prepend a tag to it. This way it shows up via docker logs with an easy way to see which program actually wrote the line.
tail -fn0 /var/log/supervisor/program1.log | ts '[Program 1]' &

How to stop/start Neo4j server via .bat script in windows

When running the neo4j server in Linux, we have several commands - start, stop, restart, etc - to control it via the command line.
In windows, the manual simply says:
Usage - Windows
Neo4j.bat
Double-clicking on the Neo4j.bat script will start the server in a console. To quit, just press control-C in the console window.
But how do I stop it if I've started it by executing neo4j.bat from a .bat file of my own, and thus don't have a console window?
For context: I'm working on an unmanaged extension, so I need to rebuild my jar, move it into the plugins directory and restart the server each time I make a change. It'd be a pain in the ass to do this manually, so (when when I was working in Linux) I had Intellij rebuild the artifact and execute a .sh script that moved the resultant jar into /plugins and restarted neo4j.
'/path/to/neo4j/bin/neo4j' stop
rm /path/to/neo4j/plugins/api.jar
mv /project/path/artifacts/graphapi.jar /path/to/neo4j/plugins/api.jar
'/path/to/neo4j' start
How do I do the same in windows using a .bat file?
I've tried this:
del "C:/path/to/neo/plugins/api.jar
move "C:/project/path/artifacts/api.jar" "C:/path/to/neo/plugins/api.jar"
C:/neo/bin/Neo4j.bat
hoping that simply calling Neo4j.bat again would stop the current process and start another, but apparently that's not the case.
If you're on Windows you can stop Neo4j server by executing: neo4j.bat stop
Let me show it in details for those who might be new to the command line:
We need to know where Neo4j is located. If you remember where did you extract it - good, you can skip this step. For others: open Task Manager and look for Commons Daemon Service Runner here how it looks like right mouse click, open Properties and look for its Location path. Find this path in your file manager. We are looking for bin folder with neo4j.bat file.
Open command line and write cd and then paste your path, hit enter. You should jump to that folder with neo4j.bat file.
Stop the server: Type neo4j.bat stop and execute. It will ask for your permission .
after that, you can double check and type 'neo4j.bat status` t be sure it's stopped.
P.S. After Windows reboot neo4j server will be automatically restarted. If you don't want this (it consumes up to 500Mb of memory, at least in my DB ~64k records) you should uninstall the service.
Execute neo4j.bat uninstall-service in that directory.
Cheers!

Resources