eryajf / go-ldap-admin

🌉 基于Go+Vue实现的openLDAP后台管理项目
http://ldapdoc.eryajf.net
Apache License 2.0
1.58k stars 265 forks source link

🐛 docker-compose 版本 admin账户無法登入 UI,显示登录状态已失效 #248

Closed RavenLiao closed 1 year ago

RavenLiao commented 1 year ago

您使用的场景? | Your usage scenarios?

Docker compose 部署

version: '3'

networks:
  go-ldap-admin:
    driver: bridge

services:
  mysql:
    image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/mysql-server:5.7
    container_name: go-ldap-admin-mysql # 指定容器名称,如果不设置此参数,则由系统自动生成
    hostname: go-ldap-admin-mysql
    restart: always # 设置容器自启模式
    ports:
      - '3307:3306'
    environment:
      TZ: Asia/Shanghai # 设置容器时区与宿主机保持一致
      MYSQL_ROOT_PASSWORD: 123456 # 设置root密码
      MYSQL_ROOT_HOST: "%"
      MYSQL_DATABASE: go_ldap_admin
#    volumes:
##      # 数据挂载目录自行修改哦!
 #     - /etc/localtime:/etc/localtime:ro # 设置容器时区与宿主机保持一致
 #     - ./data/mysql:/var/lib/mysql/data # 映射数据库保存目录到宿主机,防止数据丢失
 #     - ./config/my.cnf:/etc/mysql/my.cnf # 映射数据库配置文件
    command: --default-authentication-plugin=mysql_native_password #解决外部无法访问
    networks:
      - go-ldap-admin

  openldap:
    image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/openldap:1.4.0
    container_name: go-ldap-admin-openldap
    hostname: go-ldap-admin-openldap
    restart: always
    environment:
      TZ: Asia/Shanghai
      LDAP_ORGANISATION: "eryajf.net"
      LDAP_DOMAIN: "eryajf.net"
      LDAP_ADMIN_PASSWORD: "123456"
    command: [ '--copy-service' ]
#    volumes:
#      - ./data/openldap/database:/var/lib/ldap
#      - ./data/openldap/config:/etc/ldap/slapd.d
#      - ./config/init.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/init.ldif
    ports:
      - 388:389
    networks:
      - go-ldap-admin

  phpldapadmin:
    image: registry.cn-hangzhou.aliyuncs.com/ali_eryajf/phpldapadmin:0.9.0
    container_name: go-ldap-admin-phpldapadmin
    hostname: go-ldap-admin-phpldapadmin
    restart: always
    environment:
      TZ: Asia/Shanghai # 设置容器时区与宿主机保持一致
      PHPLDAPADMIN_HTTPS: "false" # 是否使用https
      PHPLDAPADMIN_LDAP_HOSTS: go-ldap-admin-openldap # 指定LDAP容器名称
    ports:
      - 8091:80
 #   volumes:
#      - ./data/phpadmin:/var/www/phpldapadmin
    depends_on:
      - openldap
    links:
      - openldap:go-ldap-admin-openldap # ldap容器的 service_name:container_name
    networks:
      - go-ldap-admin

  go-ldap-admin-server:
    image: eryajf/go-ldap-admin-server:2023-06-21_09-54
    container_name: go-ldap-admin-server
    hostname: go-ldap-admin-server
    restart: always
    environment:
      TZ: Asia/Shanghai
      WAIT_HOSTS: mysql:3306, openldap:389
    ports:
      - 8888:8888
    # volumes:  # 可按需打开此配置,将配置文件挂载到本地 可在服务运行之后,执行 docker cp go-ldap-admin-server:/app/config.yml ./config 然后再取消该行注释
    #   - ./config/config.yml:/app/config.yml
    depends_on:
      - mysql
      - openldap
    links:
      - mysql:go-ldap-admin-mysql # ldap容器的 service_name:container_name
      - openldap:go-ldap-admin-openldap # ldap容器的 service_name:container_name
    networks:
      - go-ldap-admin

  go-ldap-admin-ui:
    image: eryajf/go-ldap-admin-ui:2023-06-21_10-39
    container_name: go-ldap-admin-ui
    hostname: go-ldap-admin-ui
    restart: always
    environment:
      TZ: Asia/Shanghai
    ports:
      - 8090:80
    depends_on:
      - go-ldap-admin-server
    links:
      - go-ldap-admin-server:go-ldap-admin-server
    networks:
      - go-ldap-admin

您做了什么操作? | What did you do?

测试了curl -s localhost:8888/api/base/ping,得到正常结果 使用admin/123456第一次登录

您遇到了什么问题? | What are your problems?

登录失败 image

看了server的日志显示: image

您期望的结果是怎样的? | What is your expected outcome?

登录成功进入后台

eryajf commented 1 year ago

您好 @Raven-L👋,我已收到您的反馈,我将安排时间考虑您提交的信息并进行回复。-- 这条信息是由自动回复的机器人发出的。

Hello @Raven-L. I have received your feedback, and I will arrange time to consider the information you submitted and reply. -- This message is sent by an automatic reply robot.

eryajf commented 1 year ago

配置文件里,我看你多注释了一些东西,有一些地方是数据初始化的时候需要的,改了之后初始化就没法正常运行

RavenLiao commented 1 year ago

应该是,这两个文件是初始化需要的

docker-compose
├── config
│   ├── init.ldif
│   └── my.cnf
└── docker-compose.yaml

完全按照文档走没问题。我是用了portainer io的stack创建的,才出现问题。