Installing Wallabag 2.3.6 with LDAP authentication

Disclaimer: this article explains how to download and install a fresh version of Wallabag 2.3.6 and how to apply the LDAP patch developped by Immae (as per his guidelines).
The Wallabag developpment team has recently mentioned that they are looking into providing an LDAP version of their product, separated from the main release.

Edit 2019-02-13: updated procedure to be more generic (kudos to Immae for his feedback)

Pre-requirements

  • An empty MySQL database wallabag to connect to from the server.
  • php7.1+ installed on the server (with all required sub-packages ), as well as php-composer

Installing release 2.3.6

This is the latest available at the time of writing, however I would recommend to check ahead here what current version the LDAP patch has been prepared for (looking at Wallabag release tag), as it will decide what release version we will need to download. As said, at the time of writing the patch is aligned with release 2.3.6.
In order to be able to apply the patch, it is important to not git clone the repository but to download the zip archived version of the release.
Go to the 2.3.6 tagged version of the repository: https://github.com/wallabag/wallabag/tree/2.3.6

Download the zip file to your server and extract it in /var/www/wallabag/release_2.3.6 :

cd ~/release_2.3.6
wget https://github.com/wallabag/wallabag/archive/2.3.6.zip 
unzip 2.3.6.zip 
cd wallabag-2.3.6

Now we need to generate or download the patch file(s) from Immae’s repository. There are several ways to do this, however considering that there are currently actually 2 patches:

  • one for enabling LDAP authentication
  • one installing the composer LDAP module while avoiding a known composer issue which ends up requiring a LOT of memory to just install the module.

To get both patch together we will clone the repository, move into the gitolite_local/ldap branch, and generate our patch from there:

  • Head to https://git.immae.eu/?p=github/wallabag/wallabag.git;a=shortlog;h=refs/heads/gitolite_local/ldap and select the latest commit of the branch.

Copy and paste the URL into a [cci]curl[/cci] command on your server, in a different, temporary directory. For example:

mkdir ~/temp; cd ~/temp
git clone https://git.immae.eu/github/wallabag/wallabag.git && cd ~/temp/wallabag
git checkout -t origin/gitolite_local/ldap
git diff master > wallabag-ldap.patch

At the end you should get patch file that looks similar to this:

head wallabag-ldap.patch
diff --git a/.travis.yml b/.travis.yml
index 39306343..56b1f576 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -58,6 +58,7 @@ install:
before_script:
- PHP=$TRAVIS_PHP_VERSION
- echo "extension=ldap.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini if [[ ! $PHP = hhvm* ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;

Put the patch file back into your current wallabag installation directory and execute the patch:

mv wallabag-ldap.patch ~/release_2.3.6/wallabag-2.3.6
cd ~/release_2.3.6/wallabag-2.3.6
patch -p1 -i wallabag-ldap.patch

Deploying our patched Wallabag

Almost there, let’s get started straight away by installing the all required modules via composer:

composer install

At the end of the installation the installer will ask you to fill in the required settings for your new Wallabag instance.

note: You may hit some exception or error during the installation (I did). If the ldap-bundle installed ok though, just run the standard installation step [cci]composer install[/cci] again and you should get through with no more errors.

composer install        
[output]

 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.    

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets

 Trying to install assets as relative symbolic links.

 --- ------------------------------ ------------------
      Bundle                         Method / Error   
 --- ------------------------------ ------------------
  ✔   NelmioApiDocBundle             relative symlink
  ✔   CraueConfigBundle              relative symlink
  ✔   WhiteOctoberPagerfantaBundle   relative symlink
  ✔   FOSJsRoutingBundle             relative symlink
 --- ------------------------------ ------------------

 [OK] All assets were successfully installed.                     

Last but not least, amend your database in order to handle the LDAP users:

./bin/console --env=prod doctrine:migrations:migrate

                    Application Migrations                                      

WARNING! You are about to execute a database migration that could result in schema changes and data lost. Are you sure you wish tocontinue? (y/n)y
Migrating up to 20171125164500 from 20171125164500   

  ++ migrating 20170710113900                         

     -> ALTER TABLE wallabag_user ADD dn LONGTEXT DEFAULT NULL

  ++ migrated (14.29s) 

Follow the official installation documentation to set properly set up your HTTP server configuration (samples are provided for both Apache and Nginx).

That’s it, folks!

Leave a Reply

Your email address will not be published. Required fields are marked *