瀏覽代碼

pre-install ioncube

ioncube is tied to the php version and makes sense to tie this to the
app
Girish Ramakrishnan 6 年之前
父節點
當前提交
590c9122d1
共有 3 個文件被更改,包括 26 次插入1 次删除
  1. 5 0
      DESCRIPTION.md
  2. 8 0
      Dockerfile
  3. 13 1
      test/test.js

+ 5 - 0
DESCRIPTION.md

@@ -13,6 +13,11 @@ This app also bundles [ProFTPD](http://www.proftpd.org/) which provides `sftp://
 
 
 This app supports running one or more cronjobs. The jobs are specified using the standard crontab syntax.
 This app supports running one or more cronjobs. The jobs are specified using the standard crontab syntax.
 
 
+## ionCube
+
+ionCube is a PHP module extension that loads encrypted PHP files and speeds up webpages. ionCube is pre-installed
+and enabled by default.
+
 ### Remote Terminal
 ### Remote Terminal
 
 
 Use the [web terminal](https://cloudron.io/documentation/apps/#web-terminal) for a remote shell connection into the
 Use the [web terminal](https://cloudron.io/documentation/apps/#web-terminal) for a remote shell connection into the

+ 8 - 0
Dockerfile

@@ -87,6 +87,14 @@ RUN rm -rf /var/spool/cron && ln -s /run/cron /var/spool/cron
 # clear out the crontab
 # clear out the crontab
 RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* && truncate -s0 /etc/crontab
 RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* && truncate -s0 /etc/crontab
 
 
+# ioncube. the extension dir comes from php -i | grep extension_dir
+# extension has to appear first, otherwise will error with "The Loader must appear as the first entry in the php.ini file"
+RUN mkdir /tmp/ioncube && \
+    curl http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz | tar zxvf - -C /tmp/ioncube && \
+    cp /tmp/ioncube/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718 && \
+    rm -rf /tmp/ioncube && \
+    echo "zend_extension=/usr/lib/php/20170718/ioncube_loader_lin_7.2.so" > /etc/php/7.2/apache2/conf.d/00-ioncube.ini
+
 # configure supervisor
 # configure supervisor
 ADD supervisor/ /etc/supervisor/conf.d/
 ADD supervisor/ /etc/supervisor/conf.d/
 RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf
 RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf

+ 13 - 1
test/test.js

@@ -74,6 +74,15 @@ describe('Application life cycle test', function () {
         });
         });
     }
     }
 
 
+    function checkIonCube(callback) {
+        browser.get('https://' + app.fqdn).then(function () {
+            return waitForElement(by.xpath('//td[contains(text(), "ionCube Loader")]'));
+            // return waitForElement(by.xpath('//*[contains(text(), "Intrusion Protection&nsbp;from ioncube24.com")]'));
+        }).then(function () {
+            callback();
+        });
+    }
+
     function checkPhpMyAdmin(callback) {
     function checkPhpMyAdmin(callback) {
         superagent.get('https://' + app.fqdn + '/phpmyadmin').end(function (error, result) {
         superagent.get('https://' + app.fqdn + '/phpmyadmin').end(function (error, result) {
             if (error && !error.response) return callback(error); // network error
             if (error && !error.response) return callback(error); // network error
@@ -136,13 +145,14 @@ describe('Application life cycle test', function () {
     });
     });
 
 
     it('can view welcome page', welcomePage);
     it('can view welcome page', welcomePage);
+    it('can access ioncube', checkIonCube);
     it('can upload file with sftp', function () {
     it('can upload file with sftp', function () {
         // remove from known hosts in case this test was run on other apps with the same domain already
         // remove from known hosts in case this test was run on other apps with the same domain already
         // if the tests fail here you want below in ~/.ssh/config
         // if the tests fail here you want below in ~/.ssh/config
         // Host test.cloudron.xyz
         // Host test.cloudron.xyz
         //     StrictHostKeyChecking no
         //     StrictHostKeyChecking no
         //     HashKnownHosts no
         //     HashKnownHosts no
-        console.log('If this test fails, see the comment above this log');
+        console.log('If this test fails, see the comment above this log message');
         execSync(util.format('sed -i \'/%s/d\' -i ~/.ssh/known_hosts', app.fqdn));
         execSync(util.format('sed -i \'/%s/d\' -i ~/.ssh/known_hosts', app.fqdn));
         execSync(util.format('lftp sftp://%s:%s@%s:%s  -e "set sftp:auto-confirm yes; cd public/; put test.php; bye"', process.env.USERNAME, process.env.PASSWORD, app.fqdn, app.portBindings.SFTP_PORT));
         execSync(util.format('lftp sftp://%s:%s@%s:%s  -e "set sftp:auto-confirm yes; cd public/; put test.php; bye"', process.env.USERNAME, process.env.PASSWORD, app.fqdn, app.portBindings.SFTP_PORT));
     });
     });
@@ -170,6 +180,7 @@ describe('Application life cycle test', function () {
 
 
     it('can get uploaded file', uploadedFileExists);
     it('can get uploaded file', uploadedFileExists);
     it('can access phpmyadmin', checkPhpMyAdmin);
     it('can access phpmyadmin', checkPhpMyAdmin);
+    it('can access ioncube', checkIonCube);
 
 
     // disable SFTP
     // disable SFTP
     it('can disable sftp', function () {
     it('can disable sftp', function () {
@@ -226,6 +237,7 @@ describe('Application life cycle test', function () {
     });
     });
     it('can get uploaded file', uploadedFileExists);
     it('can get uploaded file', uploadedFileExists);
     it('can access phpmyadmin', checkPhpMyAdmin);
     it('can access phpmyadmin', checkPhpMyAdmin);
+    it('can access ioncube', checkIonCube);
 
 
     it('uninstall app', function () {
     it('uninstall app', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });