Running DreamFactory 2.0 on BlueMix

微笑、不失礼 提交于 2019-12-13 05:37:18

问题


I am trying to get DreamFactory 2.0 running on BlueMix. I have followed the instructions found at https://developer.ibm.com/bluemix/2014/06/17/getting-started-laravel-bluemix/ on running Laravel applications on BlueMix. I have everything under htdocs except for .bp-config, .cfignore, manifest.yml and composer.json. I have modified the path to artisan for all the scripts in composer.json and then did

cf push df2

In the log messages, I see the php buildpack getting installed, all the modules and then

/tmp/staged/app/php/bin/php /tmp/staged/app/php/bin/composer.phar install --no-progress --no-interaction --no-dev

The dependencies get installed just fine, then I see

Writing lock file
Generating autoload files
  [RuntimeException]
  Could not scan for classes inside "database" which does not appear to be a file nor a folder
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
-----> Composer command failed
Traceback (most recent call last):
  File "/tmp/buildpacks/php-buildpack/scripts/compile.py", line 51, in <module>
    .from_build_pack('lib/additional_commands')
  File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/builder.py", line 189, in extensions
    process_extension(path, ctx, 'compile', process, args=[self])
  File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/utils.py", line 69, in process_extension
    success(getattr(extn, to_call)(*args))
  File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 420, in compile
    return composer.compile(install)
  File "/tmp/buildpacks/php-buildpack/lib/extension_helpers.py", line 154, in compile
    self._compile(install)
  File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 173, in _compile
    self.run()
  File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 305, in run
    *self._ctx['COMPOSER_INSTALL_OPTIONS'])
  File "/tmp/buildpacks/php-buildpack/extensions/composer/extension.py", line 350, in run
    shell=True)
  File "/tmp/buildpacks/php-buildpack/lib/build_pack_utils/runner.py", line 109, in stream_output
    raise CalledProcessError(retcode, cmd)
build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7ffa34c4d810>' returned non-zero exit status 1
Staging failed: Buildpack compilation step failed

Here are my files:

manifest.yaml

---
applications:
- name: df2
  memory: 512M
  buildpack: https://github.com/cloudfoundry/php-buildpack#v3.2.2
  env:
    CF_STAGING_TIMEOUT: 15
    CF_STARTUP_TIMEOUT: 15
    BP_DEBUG: "True"
  services:
   - df2-cleardb

.bp-config/options.json

{
  "WEB_SERVER":     "nginx",
  "LIBDIR":         ".",
  "COMPOSER_VENDOR_DIR": "htdocs/vendor",
  "WEBDIR": "htdocs/public",
  "NGINX_VERSION":  "{NGINX_16_LATEST}",
  "PHP_VERSION":    "{PHP_56_LATEST}",
  "PHP_EXTENSIONS": [
    "bz2",
    "curl",
    "fileinfo",
    "ldap",
    "mbstring",
    "mcrypt",
    "mongo",
    "mysql",
    "openssl",
    "pdo",
    "pdo_mysql",
    "pdo_sqlite",
    "pgsql",
    "redis",
    "sockets",
    "zip",
    "zlib"
  ]
}

composer.json

{
  "name":              "dreamfactory/dreamfactory",
  "description":       "The DreamFactory(tm) Platform.",
  "keywords":          [
    "api",
    "dreamfactory",
    "dsp",
    "rest"
  ],
  "homepage":          "https://www.dreamfactory.com/",
  "license":           "Apache-2.0",
  "authors":           [
    {
      "name":  "Arif Islam",
      "email": "arifislam@dreamfactory.com"
    },
    {
      "name":  "David Weiner",
      "email": "davidweiner@dreamfactory.com"
    },
    {
      "name":  "Jerry Ablan",
      "email": "jerryablan@dreamfactory.com"
    },
    {
      "name":  "Lee Hicks",
      "email": "leehicks@dreamfactory.com"
    }
  ],
  "support":           {
    "email":  "support@dreamfactory.com",
    "source": "https://github.com/dreamfactorysoftware/dreamfactory",
    "issues": "https://github.com/dreamfactorysoftware/dreamfactory/issues",
    "wiki":   "https://wiki.dreamfactory.com"
  },
  "minimum-stability": "dev",
  "prefer-stable":     true,
  "require":           {
    "laravel/framework":          "5.1.*",
    "tymon/jwt-auth":             "0.5.*",
    "dreamfactory/df-managed":    "dev-feature/bluemix_debug as dev-master",
    "dreamfactory/df-admin-app":  "2.0.*",
    "dreamfactory/df-core":       "0.1.*",
    "dreamfactory/df-aws":        "0.1.*",
    "dreamfactory/df-rackspace":  "0.1.*",
    "dreamfactory/df-sqldb":      "0.1.*",
    "dreamfactory/df-mongodb":    "0.1.*",
    "dreamfactory/df-couchdb":    "0.1.*",
    "dreamfactory/df-rws":        "0.1.*",
    "dreamfactory/df-salesforce": "0.1.*",
    "dreamfactory/df-soap":       "0.1.*",
    "dreamfactory/df-user":       "0.1.*",
    "dreamfactory/df-oauth":      "0.1.*",
    "dreamfactory/df-adldap":     "0.1.*"
  },
  "require-dev":       {
    "barryvdh/laravel-ide-helper": "~2.0",
    "laracasts/generators":        "~1.0",
    "laracasts/testdummy":         "~2.0",
    "phpunit/phpunit":             "~4.0",
    "phpspec/phpspec":             "~2.1",
    "laravel/homestead": "dev-master"
  },
  "autoload":          {
    "classmap": [
      "database"
    ],
    "psr-4":    {
      "DreamFactory\\": "htdocs/app/"
    }
  },
  "autoload-dev":      {
    "classmap": [
      "tests/TestCase.php"
    ]
  },
  "scripts":           {
    "pre-install-cmd":  [
      "echo \"\npath is $PWD\nls is\n$(ls -al)\"",
      "rm -rf htdocs/bootstrap/cache/*.php"
    ],
    "post-install-cmd": [
      "echo \"\npath is $PWD\nls is\n$(ls -al)\"",
      "php htdocs/artisan clear-compiled",
      "php htdocs/artisan optimize",
      "php htdocs/artisan dreamfactory:pull-migrations --dst=htdocs/database/migrations",
      "php htdocs/artisan dreamfactory:setup --force --bluemix"
    ],
    "post-update-cmd":  [
      "php htdocs/artisan clear-compiled",
      "php htdocs/artisan optimize",
      "php htdocs/artisan dreamfactory:pull-migrations --dst=htdocs/database/migrations",
      "php htdocs/artisan dreamfactory:homestead-config"
    ]
  },
  "config":            {
    "preferred-install": "source"
  },
  "extra":             {
    "branch-alias":    {
      "dev-develop": "2.0.x-dev"
    },
    "installer-paths": {
      "public/{$name}/": [
        "type:dreamfactory-app"
      ]
    }
  }
}

The dreamfactory:pull-migrations command in the post-install-cmd and post-update-cmd gather all the migrations from the vendor directory (I know, I know. Not my design) and puts them in the htdocs/database/migrations directory. The dreamfactory:setup command will create the .env file, runs key:generate, migrate and db:seed

Based on the error message, it sounds like the dreamfactory:pull-migrations isn't getting run or is erroring out, but since the app doesn't start, I have no way of looking at the file structure.

Does anybody have any ideas on why it isn't working? We're using Laravel 5.1.

Thanks!


回答1:


SOLVED!

I missed one thing from the article in my composer.json. I missed changing

"classmap": [
  "database"
],

to

"classmap": [
  "htdocs/database"
],

which would explain why it couldn't find the database directory. After that, it was a simple matter of tweaking my post-install-cmd commands.



来源:https://stackoverflow.com/questions/34779622/running-dreamfactory-2-0-on-bluemix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!