szurubooru icon indicating copy to clipboard operation
szurubooru copied to clipboard

Make szurubooru autostart on fail

Open viasux opened this issue 2 years ago • 18 comments

I do not appear to be able to run the container with "docker run szurubooru --restart unless-stopped", so how would I set it up to autostart unless manually stopped?

viasux avatar Aug 16 '22 01:08 viasux

Please share the error, that you get when running that command.

phil-flip avatar Aug 22 '22 00:08 phil-flip

docker run szurubooru --restart unless-stopped
Unable to find image 'szurubooru:latest' locally
docker: Error response from daemon: pull access denied for szurubooru, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

viasux avatar Aug 31 '22 17:08 viasux

Is there a reason, why you are not using the docker-compose file?. Because szurubooru has multiple images. You are currently trying to pull an image that doesn't exist with that name. But there is szurubooru/server and szurubooru/client. But again, because this also sets up a database and variables to encourage you to use the docker-compose file.

phil-flip avatar Aug 31 '22 17:08 phil-flip

Is there a reason, why you are not using the docker-compose file?. Because szurubooru has multiple images. You are currently trying to pull an image that doesn't exist with that name. But there is szurubooru/server and szurubooru/client. But again, because this also sets up a database and variables to encourage you to use the docker-compose file.

I believe that I am using the compose file, as I followed the installation directions.. I just have to docker compose up -d every single time

viasux avatar Aug 31 '22 17:08 viasux

Have you made sure, that you have a docker-compose.yml file? And what happens, when you run the command then?

phil-flip avatar Aug 31 '22 18:08 phil-flip

Have you made sure, that you have a docker-compose.yml file? And what happens, when you run the command then?

Yes, a docker-compose.yml file is present in the directory that I run docker compose up -d in.

viasux avatar Oct 12 '22 02:10 viasux

can you try running docker-compose up - d

so with a dash between docker and compose?

phil-flip avatar Oct 12 '22 02:10 phil-flip

can you try running docker-compose up - d

so with a dash between docker and compose?

gave me this error: ERROR: No such service: -

viasux avatar Oct 12 '22 05:10 viasux

my bad. keyboard put a space there..

docker-compose up -d

phil-flip avatar Oct 12 '22 06:10 phil-flip

docker-compose up -d

oh my bad I think thats what I was doing initially, i just typed it without the dash by accident. I just did it that way to make sure though and it still doesn't automatically start after restarting my virtual server.

viasux avatar Oct 12 '22 10:10 viasux

how does your docker-compose file look like? and what is the output from that?

phil-flip avatar Oct 12 '22 11:10 phil-flip

docker-compose.yml:

## Example Docker Compose configuration
##
## Use this as a template to set up docker-compose, or as guide to set up other
## orchestration services
version: '2'

services:

  server:
    image: szurubooru/server:latest
    depends_on:
      - sql
    environment:
      ## These should be the names of the dependent containers listed below,
      ## or FQDNs/IP addresses if these services are running outside of Docker
      POSTGRES_HOST: sql
      ## Credentials for database:
      POSTGRES_USER:
      POSTGRES_PASSWORD:
      ## Commented Values are Default:
      #POSTGRES_DB: defaults to same as POSTGRES_USER
      #POSTGRES_PORT: 5432
      #LOG_SQL: 0 (1 for verbose SQL logs)
      THREADS:
    volumes:
      - "${MOUNT_DATA}:/data"
      - "./server/config.yaml:/opt/app/config.yaml"

  client:
    image: szurubooru/client:latest
    depends_on:
      - server
    environment:
      BACKEND_HOST: server
      BASE_URL:
    volumes:
      - "${MOUNT_DATA}:/data:ro"
    ports:
      - "${PORT}:80"

  sql:
    image: postgres:11-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER:
      POSTGRES_PASSWORD:
    volumes:
      - "${MOUNT_SQL}:/var/lib/postgresql/data"

output (in this case szurubooru is already running but it basically just says it started the services when i run it and its not running, i can get the exact output if needed):

docker-compose up -d
szuru_sql_1 is up-to-date
szuru_server_1 is up-to-date
szuru_client_1 is up-to-date

viasux avatar Oct 12 '22 11:10 viasux

the software is already running, tho i can see that, server and client containers do not have restart: unless-stopped in them

phil-flip avatar Oct 12 '22 11:10 phil-flip

the software is already running, tho i can see that, server and client containers do not have restart: unless-stopped in them

should I add that then? also I said that it was already running in the post :) - still doesn't explain the error with the command i was putting initially :p but im glad to have this solution!

viasux avatar Oct 12 '22 11:10 viasux

Looks like this worked! Thank you so much for the help. Could this possibly be added to the docs so people with this issue could add it to the docker-compose?

viasux avatar Oct 12 '22 11:10 viasux

yes, you can add them to each service and re-run the command. please double check, if the the volumes have been set correctly otherwise you might loose the data.

to explain the error 1st it wouldnt work since you are trying to create another container with all the settings missing that are in the compose file and env file already pre-configured. 2nd the image name was wrong. only offical images get to have a one word service-name, like mysql or mariadb. szurubooru is not big enough for that so the author is needed in-front: author/serviceName:tagOrVersion.

phil-flip avatar Oct 12 '22 11:10 phil-flip

well.. it could be directly implemented with a PR but its unlikely that it will be accepted, considering that there are other pending for months now and there might be a good reason, why it wasnt set in the first place...

phil-flip avatar Oct 12 '22 11:10 phil-flip

yes, you can add them to each service and re-run the command. please double check, if the the volumes have been set correctly otherwise you might loose the data.

to explain the error 1st it wouldnt work since you are trying to create another container with all the settings missing that are in the compose file and env file already pre-configured. 2nd the image name was wrong. only offical images get to have a one word service-name, like mysql or mariadb. szurubooru is not big enough for that so the author is needed in-front: author/serviceName:tagOrVersion.

how do I check that the volumes are correctly set, I don't remember setting them :p - i already changed it and restarted and it looks like its fine..?

viasux avatar Oct 12 '22 12:10 viasux