Coder Social home page Coder Social logo

docker-yii2-app's People

Contributors

dependabot[bot] avatar gbisurgi avatar schmunk42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

docker-yii2-app's Issues

UnicodeDecodeError

hi, i have this error

$ docker-compose up -d
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 68, in main
  File "compose\cli\main.py", line 118, in perform_command
  File "compose\cli\command.py", line 37, in project_from_options
  File "compose\cli\command.py", line 91, in get_project
  File "compose\config\config.py", line 385, in load
  File "compose\config\config.py", line 484, in load_services
  File "compose\config\config.py", line 463, in build_services
  File "compose\config\config.py", line 448, in build_service
  File "compose\config\config.py", line 715, in process_service
  File "compose\config\config.py", line 1131, in resolve_volume_paths
  File "compose\config\config.py", line 1150, in resolve_volume_path
  File "ntpath.py", line 311, in expanduser

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9: ordinal not in range(128)
Failed to execute script docker-compose
$ docker --version
Docker version 17.10.0-ce, build f4ffd25
$ docker-compose --version
docker-compose version 1.16.1, build 6d1ac219

OS Windows 10

SQLSTATE[HY000] [2002] No such file or directory

I'm stock here for 2 days now
I keep getting this error, I don't understand why! In other posts they say to not use localhost cuz it uses mysql.sock... but I dont! When I get into mycontainer I CAN ping and login into the mysql server using

mysql -h mariadb -u root -p
OR
mysql -h 172.18.0.4 -u root -p

but with Yii it doesn't work!

Any idea?


 "name": "Exception",
        "message": "SQLSTATE[HY000] [2002] No such file or directory",
        "code": 2002,
        "type": "PDOException",
        "file": "/var/www/html/vendor/yiisoft/yii2/db/Connection.php",
        "line": 660,
        "stack-trace": [
            "#0 /var/www/html/vendor/yiisoft/yii2/db/Connection.php(660): PDO->__construct('mysql:dbname=gt...', 'saas', '######', NULL)",
            "#1 /var/www/html/vendor/yiisoft/yii2/db/Connection.php(586): yii\\db\\Connection->createPdoInstance()",
            "#2 /var/www/html/common/gtb/db/TenantPdo.php(27): yii\\db\\Connection->open()",
            "#3 [internal function]: gtb\\db\\TenantPdo->__construct(Object(yii\\db\\Connection), Array)",
            "#4 /var/www/html/vendor/yiisoft/yii2/di/Container.php(375): ReflectionClass->newInstanceArgs(Array)",
            "#5 /var/www/html/vendor/yiisoft/yii2/di/Container.php(156): yii\\di\\Container->build('gtb\\\\db\\\\TenantPd...', Array, Array)",
            "#6 /var/www/html/vendor/yiisoft/yii2/di/Container.php(174): yii\\di\\Container->get('gtb\\\\db\\\\TenantPd...', Array, Array)",
            "#7 /var/www/html/vendor/filsh/yii2-oauth2-server/Module.php(80): yii\\di\\Container->get('access_token')",
            "#8 /var/www/html/vendor/filsh/yii2-oauth2-server/controllers/RestController.php(25): filsh\\yii2\\oauth2server\\Module->getServer()",
            "#9 [internal function]: filsh\\yii2\\oauth2server\\controllers\\RestController->actionToken()",
            "#10 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)",
            "#11 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(157): yii\\base\\InlineAction->runWithParams(Array)",
            "#12 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): yii\\base\\Controller->runAction('token', Array)",
            "#13 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): yii\\base\\Module->runAction('api2/oauth/toke...', Array)",
            "#14 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): yii\\web\\Application->handleRequest(Object(yii\\web\\Request))",
            "#15 /var/www/html/backend/web/index.php(17): yii\\base\\Application->run()",
            "#16 {main}"

'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=172.18.0.4;dbname=db',
            'username' => 'root',
            'password' => '########',
            'charset' => 'utf8',
        ],

Host: Ubuntu
docker-compose.yml

version: '3'
services:
  mycontainer:
    image: nimmis/apache-php7
    ports:
      - "52022:22"
      - "3306:3306"
    container_name: mycontainer
    restart: always
    volumes:
      - ${NGINX_FILES_PATH:-./data}/gtb:/app/gtb:rw
      - ${WEB_ROOT}:/var/www/html:rw
      - ${NGINX_FILES_PATH:-./data}/mycontainer.conf.d:/etc/apache2/conf-enabled:rw
      - ${NGINX_FILES_PATH:-./data}/mycontainer.sites-enabled:/etc/apache2/sites-enabled:rw
  
  mariadb:
    image: mariadb
    container_name: mariadb
    restart: always
    volumes:
      - ${MARIADB_PATH}:/var/lib/mysql:rw
    environment:
      MYSQL_ROOT_PASSWORD: ${MARIADB_PWD}

networks:
  default:
    external:
      name: ${NETWORK:-webproxy}

Windows failes finding docker-compose file

docker-compose up -d
←[31mERROR←[0m: .IOError: [Errno 22] invalid mode ('r') or filename: u'.\\"docker-compose.yml:docker-compose.dev.yml"'

Probably because the slashes or colon :. Changes it to without slashes but same error:

COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml

Tried .\\ and ./ and without and \\

Maybe it is

SQLSTATE[HY000] [2002] No such file or directory / Connection refused

So i just want to connect the container to my local mysql server, but failed.

This is the error:

Database Exception – yii\db\Exception
SQLSTATE[HY000] [2002] No such file or directory

Caused by: PDOException
SQLSTATE[HY000] [2002] No such file or directory

in /app/vendor/yiisoft/yii2/db/Connection.php at line 602

And this is my db config:

'db' => [
	'class' => 'yii\db\Connection',
	'dsn' => 'mysql:host=localhost;dbname=project_core', //172.24.0.3
	'username' => 'root',
	'password' => 'password',
	'charset' => 'utf8',
],

After i change my config from localhost to 192.168.120.1, i got this error:

Database Exception – yii\db\Exception
SQLSTATE[HY000] [2002] Connection refused

Caused by: PDOException
SQLSTATE[HY000] [2002] Connection refused

in /app/vendor/yiisoft/yii2/db/Connection.php at line 602

Could somebody tell me what is happening? Thanks

Missing LICENSE file

What is the license of this project ?
I would like to use it as test project setup for non-commercial purposes.

oh and also there is a bug the root folder is not define correctly in index.php it should be
$rootPath = dirname(__DIR__, 1);

nginx will serve the wrong page unless you disable the default configurartion

After following the instruction in the README I have tried to connect to the nginx server and I have got the default nginx landing page.
A quick way to fix this is the following

  1. get a shell within the nginx container
    #docker-compose exec web bash
  2. rename the default conf file for nginx

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.disabled

  1. Force nginx process to read the config change
    #kill -HUP $(cat /var/run/nginx.pid)

If all worked as expected Yii application should be available as root page at
http://localhost:32768

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.