{"action":"created","issue":{"url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/6","repository_url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller","labels_url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/6/comments","events_url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/6/events","html_url":"https://github.com/rediris-es/simplesamlphp-module-idpinstaller/issues/6","id":341528726,"node_id":"MDU6SXNzdWUzNDE1Mjg3MjY=","number":6,"title":"Instalación con composer","user":{"login":"adriangmemorandum","id":12030741,"node_id":"MDQ6VXNlcjEyMDMwNzQx","avatar_url":"https://avatars3.githubusercontent.com/u/12030741?v=4","gravatar_id":"","url":"https://api.github.com/users/adriangmemorandum","html_url":"https://github.com/adriangmemorandum","followers_url":"https://api.github.com/users/adriangmemorandum/followers","following_url":"https://api.github.com/users/adriangmemorandum/following{/other_user}","gists_url":"https://api.github.com/users/adriangmemorandum/gists{/gist_id}","starred_url":"https://api.github.com/users/adriangmemorandum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriangmemorandum/subscriptions","organizations_url":"https://api.github.com/users/adriangmemorandum/orgs","repos_url":"https://api.github.com/users/adriangmemorandum/repos","events_url":"https://api.github.com/users/adriangmemorandum/events{/privacy}","received_events_url":"https://api.github.com/users/adriangmemorandum/received_events","type":"User","site_admin":false},"labels":[{"id":193625331,"node_id":"MDU6TGFiZWwxOTM2MjUzMzE=","url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"adriangmemorandum","id":12030741,"node_id":"MDQ6VXNlcjEyMDMwNzQx","avatar_url":"https://avatars3.githubusercontent.com/u/12030741?v=4","gravatar_id":"","url":"https://api.github.com/users/adriangmemorandum","html_url":"https://github.com/adriangmemorandum","followers_url":"https://api.github.com/users/adriangmemorandum/followers","following_url":"https://api.github.com/users/adriangmemorandum/following{/other_user}","gists_url":"https://api.github.com/users/adriangmemorandum/gists{/gist_id}","starred_url":"https://api.github.com/users/adriangmemorandum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriangmemorandum/subscriptions","organizations_url":"https://api.github.com/users/adriangmemorandum/orgs","repos_url":"https://api.github.com/users/adriangmemorandum/repos","events_url":"https://api.github.com/users/adriangmemorandum/events{/privacy}","received_events_url":"https://api.github.com/users/adriangmemorandum/received_events","type":"User","site_admin":false},"assignees":[{"login":"adriangmemorandum","id":12030741,"node_id":"MDQ6VXNlcjEyMDMwNzQx","avatar_url":"https://avatars3.githubusercontent.com/u/12030741?v=4","gravatar_id":"","url":"https://api.github.com/users/adriangmemorandum","html_url":"https://github.com/adriangmemorandum","followers_url":"https://api.github.com/users/adriangmemorandum/followers","following_url":"https://api.github.com/users/adriangmemorandum/following{/other_user}","gists_url":"https://api.github.com/users/adriangmemorandum/gists{/gist_id}","starred_url":"https://api.github.com/users/adriangmemorandum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriangmemorandum/subscriptions","organizations_url":"https://api.github.com/users/adriangmemorandum/orgs","repos_url":"https://api.github.com/users/adriangmemorandum/repos","events_url":"https://api.github.com/users/adriangmemorandum/events{/privacy}","received_events_url":"https://api.github.com/users/adriangmemorandum/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2018-07-16T13:54:14Z","updated_at":"2018-07-19T15:39:00Z","closed_at":null,"author_association":"COLLABORATOR","body":"Hay que estudiar que la instalación pueda llegar a hacerse por completo con composer, en lugar del script shell actual (este script lo tenéis en su última versión en /var/www/install.sh en la máquina que os he pasado)."},"comment":{"url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/comments/406321083","html_url":"https://github.com/rediris-es/simplesamlphp-module-idpinstaller/issues/6#issuecomment-406321083","issue_url":"https://api.github.com/repos/rediris-es/simplesamlphp-module-idpinstaller/issues/6","id":406321083,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjMyMTA4Mw==","user":{"login":"adriangmemorandum","id":12030741,"node_id":"MDQ6VXNlcjEyMDMwNzQx","avatar_url":"https://avatars3.githubusercontent.com/u/12030741?v=4","gravatar_id":"","url":"https://api.github.com/users/adriangmemorandum","html_url":"https://github.com/adriangmemorandum","followers_url":"https://api.github.com/users/adriangmemorandum/followers","following_url":"https://api.github.com/users/adriangmemorandum/following{/other_user}","gists_url":"https://api.github.com/users/adriangmemorandum/gists{/gist_id}","starred_url":"https://api.github.com/users/adriangmemorandum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriangmemorandum/subscriptions","organizations_url":"https://api.github.com/users/adriangmemorandum/orgs","repos_url":"https://api.github.com/users/adriangmemorandum/repos","events_url":"https://api.github.com/users/adriangmemorandum/events{/privacy}","received_events_url":"https://api.github.com/users/adriangmemorandum/received_events","type":"User","site_admin":false},"created_at":"2018-07-19T15:39:00Z","updated_at":"2018-07-19T15:39:00Z","author_association":"COLLABORATOR","body":"La alternativa al código composer anterior utilizando un script PHP es la siguiente: \r\n\r\nComposerScript/Intaller.php\r\n\r\n```php\r\n<?php\r\n\r\nnamespace ComposerScript;\r\n\r\nuse Composer\\Script\\Event;\r\n\r\nclass Installer\r\n{\r\n\r\n    public static function postInstall(Event $event)\r\n    {\r\n        self::configureSimpleSAMLphp();\r\n    }\r\n\r\n    public static function postUpdate(Event $event)\r\n    {\r\n        self::configureSimpleSAMLphp();\r\n    }\r\n\r\n    private static function configureSimpleSAMLphp()\r\n    {\r\n    \tif (file_exists('simplesamlphp')) {\r\n\t\t\tself::rm_r('simplesamlphp');\r\n\t\t}\r\n\r\n    \tshell_exec('composer create-project simplesamlphp/simplesamlphp');\r\n\t\tself::rm_r('vendor');\r\n\t\t\r\n\t\tif (!file_exists('simplesamlphp/cert')) {\r\n\t\t\tmkdir('simplesamlphp/cert');\r\n\t\t}\r\n\r\n\t\t$apacheUser = exec('ps axo user | grep apache | grep -v root | uniq');\r\n\t\t$apacheGroup = exec('ps axo group | grep apache | grep -v root | uniq');\r\n\t\t$filePermissions = octdec(\"0664\");\r\n\t\t$folderPermissions = octdec(\"0775\");\r\n\r\n\t\tcopy(\"simplesamlphp/metadata-templates/saml20-idp-hosted.php\", \"simplesamlphp/metadata/saml20-idp-hosted.php\");\r\n\t\tcopy(\"simplesamlphp/metadata-templates/saml20-idp-remote.php\", \"simplesamlphp/metadata/saml20-idp-remote.php\");\r\n\t\tcopy(\"simplesamlphp/metadata-templates/saml20-sp-remote.php\", \"simplesamlphp/metadata/saml20-sp-remote.php\");\r\n\t\tcopy(\"simplesamlphp/config-templates/acl.php\", \"simplesamlphp/config/acl.php\");\r\n\t\tcopy(\"simplesamlphp/config-templates/authmemcookie.php\", \"simplesamlphp/config/authmemcookie.php\");\r\n\t\tcopy(\"simplesamlphp/config-templates/authsources.php\", \"simplesamlphp/config/authsources.php\");\r\n\t\tcopy(\"simplesamlphp/config-templates/config.php\", \"simplesamlphp/config/config.php\");\r\n\t\tchmod(\"simplesamlphp/metadata/saml20-idp-hosted.php\", $filePermissions);\r\n\t\tchmod(\"simplesamlphp/metadata/saml20-sp-remote.php\", $filePermissions);\r\n\t\tself::copy_r(\"modules/idpinstaller\", \"simplesamlphp/modules/idpinstaller\");\r\n\t\tself::copy_r(\"modules/hubandspoke\", \"simplesamlphp/modules/hubandspoke\");\r\n\t\tself::copy_r(\"modules/sir2skin\", \"simplesamlphp/modules/sir2skin\");\r\n\t\tself::rm_r('modules');\r\n\t\tself::chmod_r(\"simplesamlphp/modules\", $folderPermissions);\r\n\r\n\t\tif (file_exists('simplesamlphp/modules/hubandspoke/default-disable')) {\r\n\t\t\trename('simplesamlphp/modules/hubandspoke/default-disable','simplesamlphp/modules/hubandspoke/default-enable');\r\n\t\t}\r\n\r\n\t\ttouch('simplesamlphp/modules/sir2skin/default-enable');\r\n\t\t\r\n\t\tif (file_exists('simplesamlphp/modules/sir2skin/default-disable')) {\r\n\t\t\trename('simplesamlphp/modules/sir2skin/default-disable','simplesamlphp/modules/sir2skin/default-enable');\r\n\t\t}\r\n\r\n\t\tself::downloadAndWriteConfig();\r\n\t\tchmod(\"simplesamlphp/config/config.php\", $filePermissions);\r\n\t\tchmod(\"simplesamlphp/modules/idpinstaller/lib/makeCert.sh\", $folderPermissions);\r\n\r\n\t\tif (file_exists('simplesamlphp/modules/sir2skin/default.disable')) {\r\n\t\t\trename('simplesamlphp/modules/sir2skin/default.disable','simplesamlphp/modules/sir2skin/default-enable');\r\n\t\t}\r\n\t\t\r\n\t\tself::chmod_r(\"simplesamlphp/cert\", $folderPermissions);\r\n\t\tself::chown_r('simplesamlphp', $apacheUser, $apacheGroup);\r\n    }\r\n\r\n    private static function downloadAndWriteConfig()\r\n    {\r\n\r\n\t\t$ch = curl_init();\r\n\r\n\t\tcurl_setopt($ch, CURLOPT_URL, \"http://www.rediris.es/sir2/IdP/install/config.php.txt\");\r\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\r\n\r\n\t\t$result = curl_exec($ch);\r\n\t\t\r\n\t\tcurl_close ($ch);\r\n\r\n\t\tfile_put_contents('simplesamlphp/config/config.php', $result);\r\n\r\n    }\r\n\r\n    private static function chmod_r($path, $filemode) \r\n    {\r\n\t    chmod($path, $filemode);\r\n\r\n\t    $d = opendir($path);\r\n\r\n\t    while (($file = readdir($d)) !== false) {\r\n\t        if($file != '.' && $file != '..') {\r\n\t\t        $typepath = $path.'/'.$file;\r\n\r\n\t\t        if (filetype ($typepath) == 'dir') {\r\n\t                self::chmod_r($typepath, $filemode);\r\n\t            }\r\n\t            chmod($typepath, $filemode);\r\n\t        }\r\n\t    }\r\n\r\n\t    closedir($d);\r\n\r\n\t}\r\n\r\n\r\n    private static function chown_r($path, $uid, $gid)\r\n\t{\r\n\t\tchown($path, $uid);\r\n\t\tchgrp($path, $gid);\r\n\r\n\t    $d = opendir ($path) ;\r\n\t    \r\n\t    while(($file = readdir($d)) !== false) {\r\n\t        if ($file != \".\" && $file != \"..\") {\r\n\r\n\t            $typepath = $path . \"/\" . $file ;\r\n\r\n\t            if (filetype ($typepath) == 'dir') {\r\n\t                self::chown_r($typepath, $uid, $gid);\r\n\t            }\r\n\r\n\t            chown($typepath, $uid);\r\n\t            chgrp($typepath, $gid);\r\n\r\n\t        }\r\n\t    }\r\n\r\n\t    closedir($d);\r\n\r\n\t}\r\n\r\n\r\n    private static function rm_r($src) \r\n    {\r\n\t    $dir = opendir($src);\r\n\t    while(false !== ( $file = readdir($dir)) ) {\r\n\t        if (( $file != '.' ) && ( $file != '..' )) {\r\n\t            $full = $src . '/' . $file;\r\n\t            if ( is_dir($full) ) {\r\n\t                self::rm_r($full);\r\n\t            }\r\n\t            else {\r\n\t                unlink($full);\r\n\t            }\r\n\t        }\r\n\t    }\r\n\t    closedir($dir);\r\n\t    rmdir($src);\r\n\t}\r\n\r\n\r\n\tprivate static function copy_r($src,$dst) \r\n\t{\r\n\t    $dir = opendir($src);\r\n\t    @mkdir($dst);\r\n\t    while(false !== ( $file = readdir($dir)) ) {\r\n\t        if (( $file != '.' ) && ( $file != '..' )) {\r\n\t            if ( is_dir($src . '/' . $file) ) {\r\n\t                self::copy_r($src . '/' . $file,$dst . '/' . $file);\r\n\t            }\r\n\t            else {\r\n\t                copy($src . '/' . $file,$dst . '/' . $file);\r\n\t            }\r\n\t        }\r\n\t    }\r\n\t    closedir($dir);\r\n\t}\r\n}\r\n\r\n?>\r\n```\r\n\r\ncomposer.json\r\n\r\n```json\r\n{\r\n    \"name\": \"simplesamlphp/simplesamlphp\",\r\n    \"description\": \"Instalación de SimpleSAMLphp junto con los paquetes de REDIRIS para la instalación del IDP\",\r\n    \"version\": \"v0.1\",\r\n    \"type\": \"project\",\r\n    \"keywords\": [ \"saml2\", \"rediris\",\"oauth\",\"ws-federation\",\"sp\",\"idp\", \"simplesamlphp\" ],\r\n    \"homepage\": \"https://wiki.rediris.es/SIR2/IdP_de_referencia\",\r\n    \"license\": \"LGPL-2.1-or-later\",\r\n    \"authors\": [\r\n        {\r\n            \"name\": \"Adrian Gomez\",\r\n            \"email\": \"adriangomez@memorandum.net\"\r\n        }\r\n    ],\r\n    \"autoload\": {\r\n        \"psr-0\": {\r\n\t\t\"ComposerScript\\\\Installer\" : \"\"\r\n\t }\r\n    },\r\n    \"require\": {\r\n\t\"rediris-es/simplesamlphp-module-idpinstaller\": \"1.0.13\",\r\n        \"mimaen/simplesamlphp-module-hubandspoke\": \"dev-master\",\r\n        \"rediris-es/simplesamlphp-module-sir2skin\": \"v1.0.15\"\r\n    },\r\n    \"support\": {\r\n        \"issues\": \"https://github.com/rediris-es/simplesamlphp-module-idpinstaller/issues\",\r\n        \"source\": \"https://github.com/rediris-es/simplesamlphp-module-idpinstaller\"\r\n    },\r\n    \"scripts\": {\r\n\t\"post-install-cmd\": \"ComposerScript\\\\Installer::postInstall\",\r\n\t\"post-update-cmd\": \"ComposerScript\\\\Installer::postUpdate\"\r\n    }\r\n\r\n}\r\n```"}}
{"actor":{"display_login":"adriangmemorandum"}}