1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is Wget XenForo Possible?

Discussion in 'General XenForo Discussion and Feedback' started by ibnesayeed, Apr 7, 2015.

  1. ibnesayeed

    ibnesayeed Well-Known Member

    In order to update my XenForo installation, currently, I have to login as customer, clock on XenForo or XF Resource link then chose a version number, tick if I want full download or an upgrade package and tick the TnC checkbox. When I click on download button, sends a post request to the server which then downloads the archived file on my computer. Now I will have to upload and extract to my server and place in proper directory before I can begin upgrade.

    This workflow is not very pleasant and I would like to know if there is a way to have a link that I can wget with the help of a custom upgrade script while still being on the server machine without requiring to download it on my local machine first.

    If it is not possible yet, I would propose the following workflow:

    - Allow customers to generate a unique access key that lasts until manually deactivated/removed or license expires.
    - Provide a download link that has the "access key", "product name", "upgrade only", and "version number" as parameters.
    - Make the version number default to the "latest-stable" which can accept a three point version number as value or one of the "latest-stable" and "latest-pre".
     
    Sadik B, Avensen, thedude and 4 others like this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    This isn't possible at the moment, no.
     
  3. Digital Doctor

    Digital Doctor Well-Known Member

    It's a good idea.

    But it's not really that bad !

    upload_2015-4-7_18-1-21.png
     
    pegasus, GliX and Fred. like this.
  4. ibnesayeed

    ibnesayeed Well-Known Member

    Thanks for the response Chris. I think I will create a feature request then, except it is not a feature request that is associated with XF forum software or any other resources, but the customer area enhancement instead. But I am wondering if that "no" was a rejection of the proposal or emphasis on the current system's inability to do so? :)
     
  5. Digital Doctor

    Digital Doctor Well-Known Member

    Shouldn't upgrades be tested on a non-live copy of your Xenforo forum first?
    Wouldn't direct downloads to the server greatly encourage people to NOT test first ?
    Wouldn't direct downloads to the server greatly encourage people to NOT even backup their Xenforo first ?

    Although upgrading Xenforo seems almost effortless ... it might be just wishful thinking that upgrading your Xenforo is without risk.
     
  6. BamaStangGuy

    BamaStangGuy Well-Known Member

    Would really love this as well
     
  7. ibnesayeed

    ibnesayeed Well-Known Member

    Can't custom upgrade script be used for upgrading the test installation first?
    Can't the server itself has a test installation? Do you think everyone is supposed to have a test installation locally? I would rather prefer to test on the same hardware, environment, and the software stack where my live site runs.
    Can't custom upgrade script have code to make a backup of existing code base and data before upgrading?

    I think this only removes the friction of downloading files locally and then uploading it to the server. At some point I had a git server running on my server where I can push the new stuff from my local machine and with the help of a post commit hook it was updating the cold deployment directory. Now that I am building a different style of deployment stack, I am planning to migrate to a different workflow where I would use private repositories of GitHub or BitBucket to push the changes and fetch the code from there to my server, but it would be nice if I can fetch the code from XenForo directly. :)
     
  8. Digital Doctor

    Digital Doctor Well-Known Member

    Nope.
    Definitely no.
    Nope. I'd guess 5% of Xenforo installs test offline first. (Just a pure guess).

    But if a Xenforo upgrade scrambles your site ... Xenforo will take zero blame and will say ... It's your fault you should have tested it first.

    Of course, we've been lulled into complacency because upgrading Xenforo has been like a dream. Quick and Easy. So easy .... it seems like a good idea to automate the upgrades a bit is a good idea.

    Of course, wait til your site is offline for a few days after a bad upgrade.
    You won't regret testing if offline in the future, even if it takes a few hours.
    And the 6 minutes of wasted time downloading then uploading will never bother you again.

    If you are sick up updating ... just update once a year like I do !
    :)
    /lazy admin.

    Xenforo is so stable it rarely needs updating.
     
  9. Digital Doctor

    Digital Doctor Well-Known Member

    FWIW, I love your idea.
    It is sorta like how Wordpress does things.
    You dont have to leave your AdminCP to:
    - upgrade Wordpress.
    - download addons
    - upgrade addons.
    -etc.

    Wait til XF 2.0 comes out and you have to:
    (1) check to see if your 20 1.x addons work with 2.0
    (1b) check again to see if your 20 1.x addons work with 2.0
    (1c) wait
    (1d) check again to see if your 20 1.x addons work with 2.0
    (1d) wait for that last addon to be compatible.
    (2) download all 20 addons.
    (3) manually re-install all the addons.
     
  10. ibnesayeed

    ibnesayeed Well-Known Member

    Why not? :)
    I always prefer strong parity between test installation and production installation systems. I can't rely on a local installation on something like WAMP/XAMP on Windows or Mac (by the way I use Linux) and assume that this same effect will be there on my production server where I am running Linux. I would actually try to keep the same versions of PHP, MySQL, Apache/Nginx, and even the Linux distribution I use. To have such strong parity, there is no better way than using the same/similar server for test installation. :)
    My proposal only removes friction of downloading locally first and uploading it to the server. I don't think this ease will cause those estimated/guessed 5% to change their practice. :)

    There is a bigger picture and brighter side of this proposal than just upgrading. Recently I was building a Docker container for my XenForo installation that I can use on my server. I thought it would be nice if I can share it with the community so that they have an easy way to deploy XenForo on their VPS. The problem is, I am not supposed to share XenForo code with anyone. But what if the container is designed in a way that it can download the code at build time using the access key passed by the user on their behalf. Imagine a one click XenForo deployment services on hosts like DigitalOcean or Linode similar to how Demo installation works here. :)
     
    Last edited: Apr 8, 2015
  11. Digital Doctor

    Digital Doctor Well-Known Member

    Update scripts don't usually fail because of server settings.
    Update scripts cause site problems because of modifications / addons.
    So the part that needs testing is usually the unique combo of addons each site has in combination with unique php versions, etc.
    The only practical way to test that is the admin testing it on a demo server of the site.

    Anyway... better idea.

    Your idea might be ideally suited for smaller upgrades that are very low risk for "going wrong".
    Maybe smaller updates could just be listed in the AdminCP and be "one button" click updates.


    Xenforo.1.4.6.update.small.admin.CP.jpg

    Xenforo.com itself could that a certain update is low risk and low risk updates could be pushed out as you have outlined.

    Of course, many admins would be 100% against updating this way, likely citing security concerns.
    So Xenforo would have to do both methods.
     
  12. TheRevTastic

    TheRevTastic Well-Known Member

    The idea he brought up though doesn't stop people from testing the upgrade on a demo server of the site... You even said the server that the site runs on can't also have a test instance for upgrading reasons (and other reasons), it seems to me that you're not really understanding what he is saying.
     
  13. ibnesayeed

    ibnesayeed Well-Known Member

    On the contrary, I think it will enable some robust and scalable approaches for large and complex setup. I will reiterate that this option will be an additional feature (not mandatory) that will have no affect on X% of customers who think that the current setup is adequate and suitable for their workflow while others can take advantage of it. :)
     
  14. Jeremy P

    Jeremy P Well-Known Member

    For what it's worth, you could write a script that logs in to the Customer Area and performs the download. CURL is capable of sending POST requests and returning cookies, you could probably write it in plain bash.
     
    lol768 likes this.
  15. Arno Nühm

    Arno Nühm Active Member

    For the time of this topic and all the answers a lot of downloads and installations could have been made... ;)
     
  16. Sim

    Sim Well-Known Member

    I currently have 8 licenses of XenForo.

    Upgrading them all is a time consuming process.

    I would appreciate a mechanism allowing me to automate as much of this process as possible.

    I don't think wget is the best solution. I think a CLI based solution would be much more workable.

    I already use remote deployment tools which link into my source code control systems to automate upgrades for all of my other non-XenForo websites. A solution allowing me to use the same tools for XenForo would be very welcome.
     
  17. Jeremy P

    Jeremy P Well-Known Member

    Here is a (somewhat primitive) bash script I just came up with. The only caveat is that your email and password must be URL-encoded. For some reason I couldn't overcome this with CURL's --data-urlencode, but it should be possible.

    The licence number is what follows ?l= when you visit the download page for your licence in a browser.

    Also, it doesn't check for errors (ie if the login doesn't work, it will try to download it anyways and end up writing an html file to the download location).

    I am not responsible if this script burns your house down, eats your dog's homework, or anything else.. but it should be pretty easy to follow what it's doing and adapt it to your needs.

    Code:
    #! /usr/bin/env bash
    
    ###############################################################################
    #                                    CONFIG                                   #
    ###############################################################################
    EMAIL="xenforo%40gmail.com"
    PASSWORD="p4ssw0rd"
    LICENSE="12A3B4CD56"
    
    ###############################################################################
    #                              DO NOT EDIT BELOW                              #
    ###############################################################################
    
    # remove old version
    rm -f ./xf-upgrade.zip
    
    # login
    curl -c ./xfcookie --data "email=$EMAIL&password=$PASSWORD" https://xenforo.com/customers/login
    
    # grab latest version id
    VERSION_ID=$(curl -s -b ./xfcookie "https://xenforo.com/customers/download?l=$LICENSE&d=xenforo" | sed -nr 's/^.+<option value="([[:digit:]]+)" selected="selected">.+<\/option>/\1/p')
    
    # download
    curl -b ./xfcookie --data "download_version_id=$VERSION_ID&options[upgradePackage]=1&agree=1&l=$LICENSE&d=xenforo" https://xenforo.com/customers/download -o ./xf-upgrade.zip
    
    # cleanup
    rm -f ./xfcookie
    
     
  18. ibnesayeed

    ibnesayeed Well-Known Member

    Thanks @Jeremy P, I appreciate your effort for writing the code. I could have done that, but I was avoiding writing a mini bot or page scraping. :)
     
  19. Avensen

    Avensen Member

    Indeed, if you have a bunch of XenForo forums, upgrading all of them is time consuming.

    It's 2015, developers should consider automation of these steps in admincp via 1 click of a button:

    1. Downloading the latest upgrade package from Xenforo server to the forums root directory.
    2. Unzipping the archive files with overwrite.
    3. Deleting the upgrade package.
    4. Running the upgrade script.

    I think this will save many hours of labor for forum owners in the long run.
     
    Last edited: Apr 8, 2015
  20. ibnesayeed

    ibnesayeed Well-Known Member

    And how will this magically be different if current workflow of downloading locally and uploading to the server remains the practice?
     

Share This Page