gabrielmoreira / craftman

Craft CMS Manager
MIT License
124 stars 11 forks source link

Installing is copying to root directory #3

Open chrisdubya opened 8 years ago

chrisdubya commented 8 years ago

When following the documentation, the site seems to be moving to the ~/ directory. Any ideas? Is this expected?

Here's the zsh output

other mkdir mysite && cd mysite ➜ mysite craftman --port=8080 install ===> Installing Craft... ===> Preparing to download Craft CMS ===> + Using Craft CMS from local cache ===> Extracting Craft CMS zip ===> + Unzipping craft.zip to /Users/chriswilliams/Sites/../site ===> Generating Craft CMS configurations ===> + Generating 'scripts/install/010_dependencies.sh' ===> + Generating 'site/craft/config/db.php' ===> + Generating 'site/craft/config/general.php' ===> + Generating 'docker-compose.yml' ===> + Generating 'scripts/override/usr/local/etc/php/php.ini' ===> + Generating 'scripts/install/100_composer.sh' ===> Starting Craft CMS containers Starting chriswilliams_mysql_data_1 chriswilliams_mysql_1 is up-to-date Recreating chriswilliams_craft_1 ===> Copying all files and directories from '/Users/chriswilliams/Sites/../scripts/override' to craft container root '/'.'

gabrielmoreira commented 8 years ago

Hi @chrisdubya! Thank you for sending your issue.

Unfortunately, I do not have a Mac to test. Initial support was made by @nickcanz at #2 pull request.

You could try : DEBUG=1 craftman --port=8080 install

and send the log to help us ... Any help is always welcome, and thank you for your time.

chrisdubya commented 8 years ago

here's the output with DEBUG:

craftman__test DEBUG=1 craftman --port=8080 install ---> Project path: /Users/chriswilliams/tests/.. ---> Loading /Users/chriswilliams/.craftman/config ---> Loading custom plugins from /Users/chriswilliams/.craftman/plugins ---> All plugins: ---> Loading core plugins from /Users/chriswilliams/.craftman/bin/plugins ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/composer/composer.plugin ---> + Plugin added composer ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/heroku/heroku.plugin ---> + Plugin added heroku ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/mysql/mysql.plugin ---> + Plugin added mysql ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/phpimage/phpimage.plugin ---> + Plugin added phpimage ---> All plugins: composer heroku mysql phpimage ---> Loading /Users/chriswilliams/tests/../.craftman/config ---> Searching /Users/chriswilliams/tests/../.craftman/config.d/*.conf ---> Config file count 1 ---> Loading [/Users/chriswilliams/tests/../.craftman/config.d/docker-ports.conf] ---> Removing /Users/chriswilliams/tests/../.craftman/config.d/docker-ports.conf ===> Installing Craft... ===> Preparing to download Craft CMS ===> + Using Craft CMS from local cache ===> Extracting Craft CMS zip [ERROR] + /Users/chriswilliams/tests/../site is not empty

It's still installing the volumes in my root directory.

Thanks for your support

gabrielmoreira commented 8 years ago

Hi @chrisdubya ,

Can you run this:

craftman --upgrade
rm -rf ~/temp-site
mkdir ~/temp-site
cd ~/temp-site
TRACE=1 DEBUG=1 craftman install

I can't test without Mac OSX. But i think it can be one of these lines:

https://github.com/gabrielmoreira/craftman/blob/6ef3b282e56c14e021ee62fffc9675fb54458993/craftman

line 57: // calculating project path

CM_PROJECT_PATH=$(cm_find_closest "$CM_PROJECT_CONFIG")

line 845: // find .craftman directory in current directory

FIND=$(find "$search_dir" -maxdepth 1 -mindepth 1 -name "$filename")

line 837: // if not found, try upper directory

search_dir="$(cm_get_canonical_path "$search_dir/..")"

... but cm_get_canonical_path() function is different for OSX:

line 39: // get canonical path for directory

cm_get_canonical_path()
{
  if [[ "$OSTYPE" == "darwin"* ]]; then
    cm_readlink "$1"
  else
    readlink -f "$1"
  fi
}

line 17: OSX implementation for cm_readlink

# `readlink -f` implementation from https://gist.github.com/esycat/5279354
# because OSX's version of readlink differs from the Linux version
cm_readlink()
{
  TARGET=$1

  cd $(dirname "$TARGET")
  TARGET=$(basename "$TARGET")

  while [ -L "$TARGET" ]
  do
    TARGET=$(readlink "$TARGET")
    cd $(dirname "$TARGET")
    TARGET=$(basename "$TARGET")
  done

  DIR=`pwd -P`
  RESULT="$DIR/$TARGET"

  echo $RESULT
}

@nickcanz Can you help us?

chrisdubya commented 8 years ago

@gabrielmoreira thanks for updating. Still seems to be copying into the user root. Here's the DEBUG dump:

TRACE=1 DEBUG=1 craftman install ---> Project path: /Users/chriswilliams/temp-site/.. ---> Loading /Users/chriswilliams/.craftman/config ---> Loading custom plugins from /Users/chriswilliams/.craftman/plugins ---> All plugins: ---> Loading core plugins from /Users/chriswilliams/.craftman/bin/plugins ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/composer/composer.plugin ---> + Plugin added composer ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/heroku/heroku.plugin ---> + Plugin added heroku ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/mysql/mysql.plugin ---> + Plugin added mysql ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/phpimage/phpimage.plugin ---> + Plugin added phpimage ---> All plugins: composer heroku mysql phpimage ---> Loading /Users/chriswilliams/temp-site/../.craftman/config ---> Searching /Users/chriswilliams/temp-site/../.craftman/config.d/.conf ---> Config file count 1 ---> Loading [/Users/chriswilliams/temp-site/../.craftman/config.d/docker-ports.conf] > Run composerconfig > Run herokuconfig > Run mysqlconfig > Run phpimageconfig > Run composerinit > Run herokuinit > Run mysqlinit *> Run phpimage__init CM_APACHE_MODS_ENABLE='rewrite setenvif deflate headers filter' CM_APP_DIR=site CM_APP_PATH=/Users/chriswilliams/temp-site/../site CM_APT_INSTALL=' libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev libmagickwand-dev vim curl git wget unzip' CM_BACKUPS_DIR=backups CM_BACKUPS_PATH=/Users/chriswilliams/temp-site/../backups CM_CACHE=/Users/chriswilliams/.craftman/cache CM_CONFIG_PATH=/Users/chriswilliams/.craftman/config CM_CRAFT_DB_CONFIG_PATH=/Users/chriswilliams/temp-site/../site/craft/config/db.php CM_CRAFT_DOWNLOAD_URL='https://craftcms.com/latest.zip?accept_license=yes' CM_CRAFT_GENERAL_CONFIG_PATH=/Users/chriswilliams/temp-site/../site/craft/config/general.php CM_CRAFT_HTTP_PORT=8080 CM_CRAFT_ZIP=/Users/chriswilliams/.craftman/cache/craft-2016-03.zip CM_CRAFT_ZIPNAME=craft-2016-03.zip CM_CUSTOM_CONFIG_PATH=/Users/chriswilliams/.craftman/config.d CM_CUSTOM_INSTALL= CM_DOCKER_COMPOSE=docker-compose.yml CM_DOCKER_COMPOSE_PATH=/Users/chriswilliams/temp-site/../docker-compose.yml CM_DOCKER_CRAFT_CUSTOM_VOLUMES= CM_DOCKER_CRAFT_DEFAULT_ENV=' - CRAFT_DEVMODE=true' CM_DOCKER_CRAFT_DEFAULT_VOLUMES=' - "./site:/var/www" CM_DOCKER_CRAFT_ENVS=() CM_DOCKER_DATA_IMAGE=debian:jessie CM_DOCKER_MYSQL_DATA_VOLUMES=' - /var/lib/mysql' CM_DOCKER_MYSQL_ENV=' - MYSQL_DATABASE=craft CM_DOCKER_MYSQL_IMAGE=mariadb:10.1 CM_DOCKER_PHP_IMAGE=php:5-apache CM_FORCE_DOWNLOAD=0 CM_FORCE_OVERWRITE=0 CM_FORCE_RECREATE=0 CM_GROUP= CM_INSTALLER_DIR=install CM_INSTALLER_PATH=/Users/chriswilliams/temp-site/../scripts/install CM_INSTALL_DEPENDENCIES=010_dependencies.sh CM_INSTALL_DEPS_PATH=/Users/chriswilliams/temp-site/../scripts/install/010_dependencies.sh CM_PECL_INSTALL=imagick CM_PHP_EXT_ENABLE=imagick CM_PHP_EXT_INSTALL='iconv mcrypt gd mbstring pdo pdo_mysql zip' CM_PHP_INI_PATH=/Users/chriswilliams/temp-site/../scripts/override/usr/local/etc/php/php.ini CM_PLUGINS=([0]="composer" [1]="heroku" [2]="mysql" [3]="phpimage") CM_PLUGINS_CORE_DIR=/Users/chriswilliams/.craftman/bin/plugins CM_PLUGINS_DIR=/Users/chriswilliams/.craftman/plugins CM_PLUGIN_PREFIX= CM_PROJECT_CONFIG=.craftman CM_PROJECT_CRAFTMAN_CONFIG=/Users/chriswilliams/temp-site/../.craftman/config CM_PROJECT_CRAFTMAN_PATH=/Users/chriswilliams/temp-site/../.craftman CM_PROJECT_CUSTOM_CONFIG_PATH=/Users/chriswilliams/temp-site/../.craftman/config.d CM_PROJECT_DIR=.. CM_PROJECT_NAME=.. CM_PROJECT_PATH=/Users/chriswilliams/temp-site/.. CM_ROOT=/Users/chriswilliams/.craftman/bin CM_SCRIPTS_DIR=scripts CM_SCRIPTS_PATH=/Users/chriswilliams/temp-site/../scripts CM_USER= CM_www_PERMISSIONS=775 _CM_CONFIG_COUNT=1 _CM_PROJECT_CONFIG_FILE=/Users/chriswilliams/temp-site/../.craftman/config.d/docker-ports.conf ---> Removing /Users/chriswilliams/temp-site/../.craftman/config.d/docker-ports.conf ---> Creating craftman project at /Users/chriswilliams/temp-site/../.craftman/config ===> Installing Craft... ===> Preparing to download Craft CMS ===> + Using Craft CMS from local cache ===> Extracting Craft CMS zip [ERROR] + /Users/chriswilliams/temp-site/../site is not empty

Thanks for your help, really keen to get this working on OSX.

chrisdubya commented 8 years ago

@gabrielmoreira @nickautomatic adding in Nick, since he wrote the shell script for craft with vagrant, and might have some ideas.

Thanks!

nickautomatic commented 8 years ago

@chrisdubya Ah, sorry Chris - I'm not familiar enough with Docker to be able to help I'm afraid! Other than it looks like the issue happens during or immediately after extracting the zip... (Sorry if that's a statement of the obvious!)

gabrielmoreira commented 8 years ago

Hi @chrisdubya !

I fixed cm_find_closest() function.

Can you test again?

craftman --upgrade
rm -rf ~/temp-site
mkdir ~/temp-site
cd ~/temp-site
TRACE=1 DEBUG=1 craftman install
chrisdubya commented 8 years ago

@gabrielmoreira Sure, I'll give it a try later today and let you know. Thanks again!

chrisdubya commented 8 years ago

@gabrielmoreira Ok, looks like the files are copying into the current directory, but still haven't been able to install, not sure what the problem is this time but here's the full trace (hopefully it's something on my end):

temp-site TRACE=1 DEBUG=1 craftman install ---> Project path: /Users/chriswilliams/temp-site ---> Loading /Users/chriswilliams/.craftman/config ---> Loading custom plugins from /Users/chriswilliams/.craftman/plugins ---> All plugins: ---> Loading core plugins from /Users/chriswilliams/.craftman/bin/plugins ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/composer/composer.plugin ---> + Plugin added composer ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/heroku/heroku.plugin ---> + Plugin added heroku ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/mysql/mysql.plugin ---> + Plugin added mysql ---> + Loading plugin /Users/chriswilliams/.craftman/bin/plugins/phpimage/phpimage.plugin ---> + Plugin added phpimage ---> All plugins: composer heroku mysql phpimage _*> Run composer__config > Run herokuconfig > Run mysqlconfig > Run phpimageconfig > Run composerinit > Run herokuinit > Run mysqlinit > Run phpimageinit CM_APACHE_MODS_ENABLE='rewrite setenvif deflate headers filter' CM_APP_DIR=site CM_APP_PATH=/Users/chriswilliams/temp-site/site CM_APT_INSTALL=' libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev libmagickwand-dev vim curl git wget unzip' CM_BACKUPS_DIR=backups CM_BACKUPS_PATH=/Users/chriswilliams/temp-site/backups CM_CACHE=/Users/chriswilliams/.craftman/cache CM_CONFIG_PATH=/Users/chriswilliams/.craftman/config CM_CRAFT_DB_CONFIG_PATH=/Users/chriswilliams/temp-site/site/craft/config/db.php CM_CRAFT_DOWNLOAD_URL='https://craftcms.com/latest.zip?accept_license=yes' CM_CRAFT_GENERAL_CONFIG_PATH=/Users/chriswilliams/temp-site/site/craft/config/general.php CM_CRAFT_HTTP_PORT= CM_CRAFT_ZIP=/Users/chriswilliams/.craftman/cache/craft-2016-03.zip CM_CRAFT_ZIPNAME=craft-2016-03.zip CM_CUSTOM_CONFIG_PATH=/Users/chriswilliams/.craftman/config.d CM_CUSTOM_INSTALL= CM_DOCKER_COMPOSE=docker-compose.yml CM_DOCKER_COMPOSE_PATH=/Users/chriswilliams/temp-site/docker-compose.yml CM_DOCKER_CRAFT_CUSTOM_VOLUMES= CM_DOCKER_CRAFT_DEFAULT_ENV=' - CRAFT_DEVMODE=true' CM_DOCKER_CRAFT_DEFAULT_VOLUMES=' - "./site:/var/www" CM_DOCKER_CRAFT_ENVS=() CM_DOCKER_DATA_IMAGE=debian:jessie CM_DOCKER_MYSQL_DATA_VOLUMES=' - /var/lib/mysql' CM_DOCKER_MYSQL_ENV=' - MYSQL_DATABASE=craft CM_DOCKER_MYSQL_IMAGE=mariadb:10.1 CM_DOCKER_PHP_IMAGE=php:5-apache CM_FORCE_DOWNLOAD=0 CM_FORCE_OVERWRITE=0 CM_FORCE_RECREATE=0 CM_GROUP= CM_INSTALLER_DIR=install CM_INSTALLER_PATH=/Users/chriswilliams/temp-site/scripts/install CM_INSTALL_DEPENDENCIES=010_dependencies.sh CM_INSTALL_DEPS_PATH=/Users/chriswilliams/temp-site/scripts/install/010_dependencies.sh CM_PECL_INSTALL=imagick CM_PHP_EXT_ENABLE=imagick CM_PHP_EXT_INSTALL='iconv mcrypt gd mbstring pdo pdo_mysql zip' CM_PHP_INI_PATH=/Users/chriswilliams/temp-site/scripts/override/usr/local/etc/php/php.ini CM_PLUGINS=([0]="composer" [1]="heroku" [2]="mysql" [3]="phpimage") CM_PLUGINS_CORE_DIR=/Users/chriswilliams/.craftman/bin/plugins CM_PLUGINS_DIR=/Users/chriswilliams/.craftman/plugins CM_PLUGIN_PREFIX= CM_PROJECT_CONFIG=.craftman CM_PROJECT_CRAFTMAN_CONFIG=/Users/chriswilliams/temp-site/.craftman/config CM_PROJECT_CRAFTMAN_PATH=/Users/chriswilliams/temp-site/.craftman CM_PROJECT_CUSTOM_CONFIG_PATH=/Users/chriswilliams/temp-site/.craftman/config.d CM_PROJECT_DIR=temp-site CM_PROJECT_NAME=temp-site CM_PROJECT_PATH=/Users/chriswilliams/temp-site CM_ROOT=/Users/chriswilliams/.craftman/bin CM_SCRIPTS_DIR=scripts CM_SCRIPTS_PATH=/Users/chriswilliams/temp-site/scripts CM_USER= CM_wwwPERMISSIONS=775 ---> Creating craftman project at /Users/chriswilliams/temp-site/.craftman/config ===> Installing Craft... ===> Preparing to download Craft CMS ===> + Using Craft CMS from local cache ===> Extracting Craft CMS zip ===> + Unzipping craft.zip to /Users/chriswilliams/temp-site/site ===> Generating Craft CMS configurations ---> + Adding '.ok' to '/Users/chriswilliams/temp-site/scripts/install/.gitignore' ===> + Generating 'scripts/install/010dependencies.sh' ===> + Generating 'site/craft/config/db.php' ===> + Generating 'site/craft/config/general.php' ===> + Generating 'docker-compose.yml' ===> + Generating 'scripts/override/usr/local/etc/php/php.ini' *> Run composer__generate ---> + Adding 'composer.phar' to '/Users/chriswilliams/temp-site/scripts/.gitignore' ===> + Generating 'scripts/install/100_composer.sh' > Run herokugenerate > Run mysqlgenerate _*> Run phpimage__generate ===> Starting Craft CMS containers Creating tempsite_mysql_data_1 Creating tempsite_mysql_1 Creating tempsite_craft_1 ===> Copying all files and directories from '/Users/chriswilliams/temp-site/scripts/override' to craft container root '/'.' ===> All configuration files synced ===> Prepare to run install scripts ===> Running install script 010_dependencies.sh stty: stdin isn't a terminal ===> Installing dependencies ===> + Configuring user and group ===> + User id: 1000 ===> + Group id: 50 staff:x:50: ===> + Configuring site permissions ===> + Set 775 permissions to /var/www ===> + Update and install apt-get libraries Err http://httpredir.debian.org jessie InRelease

Err http://httpredir.debian.org jessie-updates InRelease

Err http://security.debian.org jessie/updates InRelease

Err http://httpredir.debian.org jessie Release.gpg
Could not resolve 'httpredir.debian.org' Err http://security.debian.org jessie/updates Release.gpg Could not resolve 'security.debian.org' Err http://httpredir.debian.org jessie-updates Release.gpg Could not resolve 'httpredir.debian.org' Reading package lists... Done W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg Could not resolve 'httpredir.debian.org'

W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg Could not resolve 'httpredir.debian.org'

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Could not resolve 'security.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package libfreetype6-dev E: Unable to locate package libjpeg62-turbo-dev E: Unable to locate package libmcrypt-dev E: Unable to locate package libpng12-dev E: Unable to locate package libmagickwand-dev E: Unable to locate package vim E: Unable to locate package git E: Unable to locate package wget E: Unable to locate package unzip

gabrielmoreira commented 8 years ago

@chrisdubya ,

Try this:

docker pull debian:jessie

then run again:

rm -rf ~/temp-site
mkdir ~/temp-site
cd ~/temp-site
TRACE=1 DEBUG=1 craftman install

I'm trying to install http://www.macbreaker.com/2015/01/virtualbox-yosemite-zone.html on a Virtual Machine, to test and fix craftman on OSX.

gabrielmoreira commented 8 years ago

It's running on OSX: https://gist.github.com/gabrielmoreira/cf8d8eb47acc93ee548f

Pulling docker image php:5-apache latest version :

docker pull php:5-apache

Then run again:

rm -rf ~/temp-site
mkdir ~/temp-site
cd ~/temp-site
TRACE=1 DEBUG=1 craftman install

If you get an error, try: craftman phpimage:build

note: docker-compose from docker toolbox is not working for me on OSX, so i installed pip and bpython. But apparently your docker-compose is ok.

sudo easy_install pip bpython
sudo pip install docker-compose
chrisdubya commented 8 years ago

@gabrielmoreira This is a bit weird, but I think it has something to do with the localhost when I installed in ~/temp-site and the installation was successful, but it sets the localhost like this:

TRACE=1 DEBUG=1 craftman install ... Restarting tempsite_craft_1 ... done ===> ===> ===> ===> Run 'craftman admin' to complete installation, ===> and 'craftman open' to access your site ===> ===> ===> ===> Opening http://172.17.0.2/admin in your browser

When you go to http://172.17.0.2/admin

If you craftman install in the root folder (~), and run craftman admin it opens on http://192.168.99.100:8080/admin and works perfectly. :/

gabrielmoreira commented 8 years ago

Hi @chrisdubya, I do not recommend you to run craftman install in root folder, because craftman creates a hidden .craftman directory to control the project, and at the same time ~/.craftman is the global craftman configuration directory and the location where craftman is installed.

I think you should delete all previous generated files, directories and reinstall craftman.

1) Create backup of ~/site and ~/temp-site directory if you need.

2) Remove all directories:

rm -rf ~/.craftman
rm -rf ~/site
rm -rf ~/temp-site

3) Reinstall craftman:

curl -o- https://raw.githubusercontent.com/gabrielmoreira/craftman/master/craftman_install | sh

4) I think, in OSX, because docker is installed in a virtual machine, you can't access without port forwarding. Try running this:

craftman --port=8080 install
gabrielmoreira commented 8 years ago

I need to change craftman to force --port option when running on Mac OSX.

nicbou commented 7 years ago

I had the same issue on a fresh Ubuntu install.