laravel / homestead

MIT License
3.87k stars 1.44k forks source link

Can not clone private packages in composer #1233

Closed lloricode closed 5 years ago

lloricode commented 5 years ago

Versions

Host operating system

Release Linux Mint 19.1 Tessa 64-bit Kernel Linux 4.15.0-54-generic x86_64 MATE 1.20.1

Homestead.yaml

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
  - ~/.ssh/id_rsa

folders:
  - map: ~/Documents/homestead
    to: /home/vagrant/code

sites:
  # test
  - map: homestead72.test
    to: /home/vagrant/code/homestead72/public
    php: "7.2"

databases:
  - homestead72

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Vagrant destroy & up output

https://gist.github.com/lloricode/df3ebd9d3a7e175303609455a9b39b4c

Expected behavior

It should clone a private package

Actual behavior

Can not clone private package return from composer install with php7.2 https://gist.github.com/lloricode/d101968943e47a68d2f88639d450ea48

this is composer.json:

{
  "name": "rappasoft/laravel-5-boilerplate",
  "description": "The Laravel Boilerplate Project.",
  "keywords": [
    "framework",
    "laravel",
    "boilerplate"
  ],
  "license": "MIT",
  "type": "project",
  "repositories": [
    {
      "type": "vcs",
      "url": "git@bitbucket.org:halcyonlaravel/base.git"
    },
    {
      "type": "vcs",
      "url": "git@bitbucket.org:halcyonlaravel/module.git"
    },
    {
      "type": "vcs",
      "url": "git@bitbucket.org:halcyonlaravel/audit-history.git"
    },
    {
      "type": "vcs",
      "url": "git@bitbucket.org:halcyonlaravel/helpers.git"
    }
  ],
  "require": {
    "php": "^7.1.3",
    "ext-fileinfo": "*",
    "ext-json": "*",
    "ext-pdo": "*",
    "appstract/laravel-blade-directives": "^1.3",
    "arcanedev/log-viewer": "^4.7",
    "arcanedev/no-captcha": "^9.0",
    "creativeorange/gravatar": "~1.0",
    "davejamesmiller/laravel-breadcrumbs": "^5.0",
    "divineomega/laravel-password-exposed-validation-rule": "^2.0",
    "fideloper/proxy": "^4.0",
    "halcyon-laravel/audit-history": "^1.0",
    "halcyon-laravel/base": "^5.0",
    "hieu-le/active": "^3.5",
    "laravel/framework": "5.8.*",
    "laravel/socialite": "^4.0",
    "laravel/tinker": "^1.0",
    "laravelium/sitemap": "^3.1",
    "spatie/laravel-sluggable": "^2.1",
    "unisharp/laravel-ckeditor": "^4.7",
    "unisharp/laravel-filemanager": "^1.8",
    "webpatser/laravel-uuid": "^3.0"
  },
  "require-dev": {
    "barryvdh/laravel-debugbar": "^3.0",
    "barryvdh/laravel-ide-helper": "^2.4",
    "beyondcode/laravel-dump-server": "^1.0",
    "filp/whoops": "^2.0",
    "fzaninotto/faker": "^1.4",
    "gmsantos/inspiring": "^2.1",
    "halcyon-laravel/module": "^5.0",
    "mockery/mockery": "^1.0",
    "nunomaduro/collision": "^3.0",
    "phpunit/phpunit": "^7.5|^8.0"
  },
  "autoload": {
    "classmap": [
      "database/seeds",
      "database/factories"
    ],
    "psr-4": {
      "App\\": "app/"
    },
    "files": [
      "app/helpers.php"
    ]
  },
  "autoload-dev": {
    "psr-4": {
      "Tests\\": "tests/"
    }
  },
  "extra": {
    "laravel": {
      "dont-discover": [
      ]
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
      "@php artisan key:generate --ansi"
    ],
    "post-autoload-dump": [
      "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
      "@php artisan package:discover --ansi"
    ],
    "clear-all": [
      "@php artisan clear-compiled --ansi",
      "@php artisan cache:clear --ansi",
      "@php artisan permission:cache-reset --ansi",
      "@php artisan route:clear --ansi",
      "@php artisan view:clear --ansi",
      "@php artisan config:clear --ansi",
      "@php -r \"!file_exists('storage/framework/cache/repository-cache-keys.json') || unlink('storage/framework/cache/repository-cache-keys.json');\"",
      "@php -r \"!file_exists('storage/framework/cache/query-cache-model-repository.json') || unlink('storage/framework/cache/query-cache-model-repository.json');\"",
      "composer dump-autoload --no-interaction --ansi --optimize"
    ],
    "clear-all72": [
      "ea-php72 artisan clear-compiled --ansi",
      "ea-php72 artisan cache:clear --ansi",
      "ea-php72 artisan permission:cache-reset --ansi",
      "ea-php72 artisan route:clear --ansi",
      "ea-php72 artisan view:clear --ansi",
      "ea-php72 artisan config:clear --ansi",
      "ea-php72 -r \"!file_exists('storage/framework/cache/repository-cache-keys.json') || unlink('storage/framework/cache/repository-cache-keys.json');\"",
      "ea-php72 -r \"!file_exists('storage/framework/cache/query-cache-model-repository.json') || unlink('storage/framework/cache/query-cache-model-repository.json');\"",
      "ea-php72 composer.phar dump-autoload --no-interaction --ansi --optimize"
    ],
    "cc": [
      "@php artisan cache:clear --ansi",
      "@php artisan permission:cache-reset --ansi",
      "@php -r \"!file_exists('storage/framework/cache/repository-cache-keys.json') || unlink('storage/framework/cache/repository-cache-keys.json');\"",
      "@php -r \"!file_exists('storage/framework/cache/query-cache-model-repository.json') || unlink('storage/framework/cache/query-cache-model-repository.json');\""
    ],
    "ide-helper": [
      "@php artisan ide-helper:generate --ansi",
      "@php artisan ide-helper:meta --ansi"
    ],
    "phpunit": [
      "./vendor/bin/phpunit --verbose > phpunit.txt -d memory_limit=2048M"
    ],
    "test": [
      "./vendor/bin/phpunit --verbose"
    ]
  },
  "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
  }
}

note: halcyon-laravel/helpers is dependency from halcyon-laravel/base and halcyon-laravel/audit-history

Steps to reproduce

  1. cd ~/Homestead then vagrant destroy --force
  2. git checkout v9.0.3 while having latest Settler v8.0.0
  3. run vagrant up
  4. run vagrant ssh
  5. (on ssh/virtualbox) cd code/homestead72
  6. (on current project directory on ssh/virtualbox) run composer install
lloricode commented 5 years ago

after.sh on homestead

#!/bin/sh

# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
#
# If you have user-specific configurations you would like
# to apply, you may also create user-customizations.sh,
# which will be run after this script.

sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo npm install -g svgo
sudo apt-get install gifsicle
svpernova09 commented 5 years ago

The problem is here: https://gist.github.com/lloricode/df3ebd9d3a7e175303609455a9b39b4c#file-vagrant-up-7-11-2019-L27-L32

The keys you're mapping to vagrant via Homestead.yaml Aren't getting inserted properly so therefore the SSH keys the vagrant user has access to don't have access to your private packagist.

This can be a pretty difficult thing to debug, but it's nothing Homestead can do for you. My advice would be to not run composer operations in the vm, and instead rum them from your localhost.