baserproject / basercms

baserCMS : Based Website Development Project
http://basercms.net
Other
166 stars 128 forks source link

Unable to go to the admin panel after following docker basic setup #3657

Open steinkel opened 1 month ago

steinkel commented 1 month ago

概要

Issueの概要を What・Why も含めて書きます。

baserCMS version : latest, commit id 0f53330d40d09bec6cd66583f5f0414780c729d9

TODO

I ran the install script, reload the page to get to the install wizard. Completed the wizard correctly using sqlite https://ss.jorge-gonzalez.net/ss_20240731_123813_BvidMmW5.png

When I click the edit button or the Dashboard link, I go to a 404 error page (see how the url is changed to localhost WITHOUT the port)

https://ss.jorge-gonzalez.net/ss_20240731_123838_aBmdo0PH.png

備考

別途記載する内容があれば書きます。

ryuring commented 1 month ago

@steinkel Thank you for taking the time to try baserCMS!

You tried changing the Docker port to 8448.

I also tried installing in an environment with the same commit ID and the port changed to 8448, but unfortunately I was not able to reproduce the problem.

baserCMS is designed to rewrite /config/.env during installation, but this does not seem to be working properly.

Did you do any special settings in the Docker container?

steinkel commented 1 month ago

Hi,

This is the final docker-compose.yml file I'm using, I had to tweak 2 ports to allow the site to boot as they were in use in my local env.

➜  docker git:(5.1.x) ✗ cat docker-compose.yml
version: '3'

# volumes:
#  db-volume: # windowsの場合はコメントを外す

services:
  bc-db:
    container_name: bc-db
    image: mysql:8.0
    volumes:
      - ./volumes/mysql:/var/lib/mysql
      # - db-volume:/var/lib/mysql # windowsの場合はコメントを外し、上の行をコメントアウトする
      - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_DATABASE: "basercms"
    command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --innodb-use-native-aio=0 --default_authentication_plugin=mysql_native_password

  bc-php:
    container_name: bc-php
    image: baserproject/basercms:php8.1
    volumes:
      - ../:/var/www/html:delegated
    environment:
      PHP_IDE_CONFIG: "serverName=localhost"
      XDEBUG_MODE: "debug"
      XDEBUG_SESSION: "1"
      COMPOSER_ALLOW_SUPERUSER: 1
    ports:
      - "8088:80"
      - "8448:443"
    depends_on:
      - bc-db
    command: bash -c "/var/www/html/docker/bin/init.sh && apache2-foreground"

  bc-smtp:
    container_name: bc-smtp
    image: schickling/mailcatcher
    ports:
      - "1080:1080"
      - "1025:1025"

  bc-pma:
    container_name: bc-pma
    image: phpmyadmin
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=bc-db
      - PMA_USER=root
      - PMA_PASSWORD=root
    links:
      - bc-db
    ports:
     - 8080:80
    volumes:
       - ./phpmyadmin/sessions:/sessions

  bc-pg:
    image: postgres:15.2
    container_name: bc-pg
    volumes:
      - ./volumes/postgres:/var/lib/postgres
      - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    environment:
      POSTGRES_USER: root
      POSTGRES_PASSWORD: root
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
    user: root

  bc-pga:
    image: dpage/pgadmin4:7.8
    container_name: bc-pga
    ports:
      - 8000:80
    volumes:
      - ./pgadmin:/var/lib/pgadmin/storage
    environment:
      PGADMIN_DEFAULT_EMAIL: foo@example.com
      PGADMIN_DEFAULT_PASSWORD: root
    depends_on:
      - bc-pg

Here's the .env

➜  basercms git:(5.1.x) ✗ cat config/.env 
#!/usr/bin/env bash
# Used as a default to seed config/.env which
# enables you to use environment variables to configure
# the aspects of your application that vary by
# environment.
#
# Having this file in production is considered a **SECURITY RISK** and also decreases
# the boostrap performance of your application.
#
# To use this file, first copy it into `config/.env`. Also ensure the related
# code block for loading this file is uncommented in `config/boostrap.php`
#
# In development .env files are parsed by PHP
# and set into the environment. This provides a simpler
# development workflow over standard environment variables.
export APP_NAME="baserCMS"
export DEBUG="false"
export APP_ENCODING="UTF-8"
export APP_DEFAULT_LOCALE="ja_JP"
export APP_DEFAULT_TIMEZONE="Asia/Tokyo"

# baserCMS Settings
export INSTALL_MODE="true"
export USE_DEBUG_KIT="false"
export SITE_URL="https://localhost/"
export ADMIN_PREFIX="admin"
export BASER_CORE_PREFIX="baser"
export SQL_LOG="false"
## コアが提供する Web API を利用するかどうか
export USE_CORE_API="false"
## コアが提供する認証が必要な Web API を利用するかどうか
export USE_CORE_ADMIN_API="false"
## テスト実行時にメソッドを表示するかどうか
export SHOW_TEST_METHOD="false"
## プロキシサーバーを利用するかどうか(SSL判定に利用)
export TRUST_PROXY="false"

# Uncomment these to define cache configuration via environment variables.
#export CACHE_DURATION="+2 minutes"
#export CACHE_DEFAULT_URL="file://tmp/cache/?prefix=${APP_NAME}_default&duration=${CACHE_DURATION}"
#export CACHE_CAKECORE_URL="file://tmp/cache/persistent?prefix=${APP_NAME}_cake_core&serialize=true&duration=${CACHE_DURATION}"
#export CACHE_CAKEMODEL_URL="file://tmp/cache/models?prefix=${APP_NAME}_cake_model&serialize=true&duration=${CACHE_DURATION}"

# Uncomment these to define email transport configuration via environment variables.
#export EMAIL_TRANSPORT_DEFAULT_URL=""

# Uncomment these to define database configuration via environment variables.
#export DATABASE_URL="mysql://my_app:secret@localhost/${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"
#export DATABASE_TEST_URL="mysql://my_app:secret@localhost/test_${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"

# Uncomment these to define logging configuration via environment variables.
#export LOG_DEBUG_URL="file://logs/?levels[]=notice&levels[]=info&levels[]=debug&file=debug"
#export LOG_ERROR_URL="file://logs/?levels[]=warning&levels[]=error&levels[]=critical&levels[]=alert&levels[]=emergency&file=error"
ryuring commented 1 month ago

@steinkel Thank you for your information.

I am rewriting the .env file in the following two places, but it seems that the cause is that these are not working. I don't know why. Please let me know if you notice anything.

// rewrite SITE_URL https://github.com/baserproject/basercms/blob/0f53330d40d09bec6cd66583f5f0414780c729d9/plugins/bc-installer/src/Service/Admin/InstallationsAdminService.php#L346

// rewrite INSTALL_MODE https://github.com/baserproject/basercms/blob/0f53330d40d09bec6cd66583f5f0414780c729d9/plugins/bc-installer/src/Controller/Admin/InstallationsController.php#L212

I think it will work properly if you rewrite .env manually.