Extracted files are 0.

Issue #30 resolved
Colin Orij created an issue

Hi,

Thanks for this great script. But unfortunately I can't get it to work. It looks like the file is empty after getFileContents gets executed. The path to the master is correct, I'm able to download the zip file through my browser.

Verbose log:

BitBucket Sync - Full Deploy

PHP Info > http://deploy.boldinteractive.nl/info.php

Comments (24)

  1. Colin Orij reporter

    p.s. It's a private repository. I filled in the API user & API password field in config.php. But I don't know if this is just my regular login credentials for Bitbucket?

  2. Alexandru Lixandru repo owner

    Hello,

    The API user and pw are your bitbucket credentials indeed.

    Most of the time issues are caused by incorrect write permissions. You need to make sure the commits folder is write-accessible by the www user. Does your error_log say anything interesting?

    Regards, Alex

  3. Alexandru Lixandru repo owner

    Oh. I see boldinteractive is a team user. Did you specify the team parameter when accessing the deploy.php URL? i.e. ?setup=test&team=boldinteractive

  4. Colin Orij reporter

    No interesting stuff in the error logs and yes I specified the team parameter. This is the url I use:

    deploy.boldinteractive.nl/deploy.php?setup=test&key=XXXXXX&team=boldinteractive

  5. Colin Orij reporter

    It's 755 also tried 777. I think it's not a permission thing.

    After getFileContents is executed Curl is writing a file to the commits folder but it's empty. See screenshot. Screen Shot 2015-03-23 at 10.47.00 AM.jpg

  6. Alexandru Lixandru repo owner

    It's definitely not a permission, since new files are created. There might be 2 things: the response from bitbucket is really empty or there might be something exotic with your setup (for instance, i once had issues with some versions of curl which were too new for the script at that time).

    One thing to check is that your server is allowed to reach bitbucket and get data (maybe login through SSH and try a wget with the zip URL).

    Apart from that, I think enabling versobe mode for CURL would be a good idea. Add curl_setopt($ch, CURLOPT_VERBOSE, true); on line 406 and check the error_log.

    Apart from this, there's not much I can suggest...

    Let me know how it goes.

    Thanks, Alex

  7. Colin Orij reporter

    Cannot wget the file > 401 UNAUTHORIZED Trying to figure out why. I don't need to enable something in my Bitbucket account right for wget? Because wget is just regular download request, like in a browser. I use the following command

    wget https://colinory:XXXXXX@bitbucket.org/boldinteractive/test/get/master.zip

  8. Colin Orij reporter

    And nothing appends to my error log after turning verbose mode to true for Curl..

    But I think it's auth thing... Will keep trying the wget.. Maybe I use the wrong parameters for wget for https requests..

  9. Alexandru Lixandru repo owner

    Bitbucket uses Basic Auth, so the request is correct and it should work. However, it's not working for me either with wget. We'll keep trying myself also.

  10. Alexandru Lixandru repo owner

    FYI - I was able to get a private repo zip with wget from an ubuntu machine. So you it should work for you as well.

  11. Alexandru Lixandru repo owner

    Did your URL have /get/master.zip or simply /master.zip? Could that be an issue? Otherwise, not sure what could be. Connectivity, authentication, permissions - all are OK. I'm out of clues...

  12. Colin Orij reporter

    hm without get is not the right file. But when I add /get/ it retrieves the right file after all. So Curl is working!

  13. Colin Orij reporter

    Alex! My bad. There was a weird typo in my password in the config.php. It's working!

    :( bad case of the mondays

  14. Alexandru Lixandru repo owner

    Ah. That's OK. Hehe, I'm glad when things like this happen - in the end you know it's not something wrong with the code :)

    Take it easy! Do let me know if you run into other issues.

  15. Alexandru Lixandru repo owner

    It's on the ToDo list, but no time to work on :( Would be glad if you would like to share what you have. That would be a starting point.

  16. Colin Orij reporter

    It's very very very simple (and quick&dirty ;)). I could e-mail it to you! What's your mail?

  17. Colin Orij reporter

    config.php - Add rows from DB to $DEPLOY

    $sql = "SELECT * FROM deployments"; $result = $conn->query($sql);

    $DEPLOY = array();

    if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) {

    $DEPLOY[$row['name']] = $row['path'];

    }}

  18. Colin Orij reporter

    -- -- Table structure for table deployments --

    CREATE TABLE IF NOT EXISTS deployments ( id smallint(6) NOT NULL auto_increment, name varchar(256) NOT NULL, path varchar(256) NOT NULL, timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

  19. Log in to comment