semaphoreui / semaphore

Modern UI for Ansible, Terraform, OpenTofu, Bash, Pulumi.
https://semaphoreui.com
MIT License
10.28k stars 1.04k forks source link

Unable to edit Inventory - failed with: Request failed with status code 400 #1785

Open MGertz opened 6 months ago

MGertz commented 6 months ago

Hi.

When I try to edit an inventory, I get the error message Request failed with status code 400

image

I'm running Semaphore in a docker stack. When I look in the log for the stack, there isn't any warnings about the 400 error.

My docker-compose.yml file looks like this.

services:

  postgres:
    restart: unless-stopped
    image: postgres:14
    hostname: postgres
    volumes:
      - postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: semaphore
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: semaphore
    networks:
      - internal

  semaphore:
    image: semaphoreui/semaphore:latest
    container_name: semaphore_gui
    restart: no
    environment:
      SEMAPHORE_DB_USER: semaphore
      SEMAPHORE_DB_PASS: ${DB_PASSWORD}
      SEMAPHORE_DB_HOST: postgres # for postgres, change to: postgres | for mysql, change to: mysql
      SEMAPHORE_DB_PORT: 5432 # change to 5432 for postgres | change to 3306 for mysql
      SEMAPHORE_DB_DIALECT: postgres # for postgres, change to: postgres | for mysql, change to: mysql
      SEMAPHORE_DB: semaphore
      SEMAPHORE_PLAYBOOK_PATH: /playbooks #/tmp/semaphore/
      SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      SEMAPHORE_ADMIN_NAME: admin
      SEMAPHORE_ADMIN_EMAIL: email@examp.com (No! that has been change ;) )
      SEMAPHORE_ADMIN: admin
      SEMAPHORE_ACCESS_KEY_ENCRYPTION: ${ENCRYPTION_KEY}
      ANSIBLE_HOST_KEY_CHECKING: false
      TZ: Europe/Copenhagen
    volumes:
      - ./playbooks:/playbooks
      - ./inventory:/inventory
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik
      - traefik.http.routers.semaphore.entrypoints=web
      - traefik.http.routers.semaphore.rule=Host(`semaphore.localhost`)
      - traefik.http.services.semaphore.loadbalancer.server.port=3000
    networks:
      - traefik
      - internal
    depends_on:
      - postgres # for postgres, change to: postgres | for mysql, change to: mysql

volumes:
  mysql: # to use postgres, switch to: semaphore-postgres
  postgres:

networks:
  traefik:
    external: true
  internal:
    external: false

Does anyone know how to fix this issue?

rath17023 commented 6 months ago

I am running into this issue when trying to create credentials in the key store. I am using MySQL instead of Postgres and no Trafik.

rath17023 commented 6 months ago

I was able to solve my issue but regenerating the SEMAPHORE_ACCESS_KEY_ENCRYPTION. I had to remove and delete the volume for the database but it seems to be working now.

hcderaad commented 6 months ago

@rath17023 that means you've recreated your whole database, right? I have a somewhat similar sounding issue #1778 and can't really afford to recreate my whole db. Did you manage to look into the logs and see the actual (probably database related) issue that caused this?

fiftin commented 5 months ago

@hcderaad you don't need to recreate whole database, just update your access keys.

But I don't think it is the same problem. SEMAPHORE_ACCESS_KEY_ENCRYPTION solves access keys problem but not Inventory.

fiftin commented 5 months ago

@hcderaad is there any logs in Semaphore's output? This mean unexpected database restrictions was got. It can be result of database state or incorrect input fields.

fiftin commented 3 months ago

Hi @MGertz did you solve the issue?