rakurtz / cleanup_oc_files_lock

0 stars 0 forks source link

Instructions Unclear #1

Open AT-StephenDetomasi opened 3 weeks ago

AT-StephenDetomasi commented 3 weeks ago

I am attempting to manually clear file locks on my NextCloud AIO server running on Docker. Instructions on how to get this script running is unclear.

  1. Where are the commands supposed to be run? Within the OS that docker runs on, or within the docker container itself?

I attempted to run the following command: docker exec --user www-data -it nextcloud-aio-nextcloud php occ CREATE USER 'cleanup_user'@'localhost' IDENTIFIED BY 'password';

I received the error "Command "CREATE" is not defined".

  1. Where is the database located? Nextcloud runs several containers, including one called "Database".
  2. Are there any other commands that need to be run to achieve this on a docker environment?
rakurtz commented 3 weeks ago

Hey Stephen, thanks for your interest in the script.

The CREATE USER part is a sql command you would type after logging in to your database. From the console of the maschine/container that runs your database it could be something like "mysql -u root -p" to get into the mysql console.

I don't know the exact details of the Nextcloud docker setup. But in that case you would need to create the user in the database of the container running the database.

The python script then could be executed from the other container but then you should adjust the script to connect to the mysql host properly.

AT-StephenDetomasi commented 3 weeks ago

Okay, well I'm going nowhere with this.

Logged into my debian based host where my docker containers are running, and then opened a bash terminal for my docker container.

mysql, pip, apt commands are all not found.

image

What am I missing?

Edit: Perhaps there is a way to connect to the database from the host system, maybe by opening a port or something? Sorry for the noob questions, just trying to wrap my head around how everything talks to eachother.

rakurtz commented 3 weeks ago

Hey Stephen,

it seems they ship a very lightweight docker container with no extra software. I am afraid i can't help you here since i am not using the docker setup of nextcloud. But let me know when you've wrapped your head around that.

In general you can say that multiple docker containers often are connected to the same docker network. After that they can talk to each other by their names. You should retrieve the relevant information by analysing the outputs of docker ps a, docker network ls and maybe also docker inspect CONTAINER_ID.

Another idea: Just run a third container with the official ubuntu image and add it to the same docker network. From that container you can easily use python and apt.

docker run -it --network the_nextcloud_docker_network --name my_ubuntu_container ubuntu:latest /bin/bash

Best of luck :)

AT-StephenDetomasi commented 3 weeks ago

Thanks, I'll give this a crack and see what I can come up with.