{"id":1691,"date":"2016-11-14T08:26:54","date_gmt":"2016-11-14T14:26:54","guid":{"rendered":"http:\/\/blografia.net\/vicm3\/?p=1691"},"modified":"2018-03-03T17:45:02","modified_gmt":"2018-03-03T23:45:02","slug":"automagic-moodle-update","status":"publish","type":"post","link":"https:\/\/blografia.net\/vicm3\/2016\/11\/automagic-moodle-update\/","title":{"rendered":"Automagic Moodle update"},"content":{"rendered":"<p>Well its monday so semi auto magic roll of patches on CentOS via yum-cron on Debian broken for some dumb and strong firewall rules but applied via unattended updates now done through a ssh tunnel using tsocks, been thinking on create a permanent tunnel or one based on apt.conf and push keys to our external machine, laziness has won and it&#8217;s not implemented&#8230; but.<br \/>\nOur mini script, for every directory get git code<br \/>\ngit.sh<\/p>\n<pre>#!\/bin\/bash\r\n        for i in $( ls ); do\r\n            echo item: $i\r\n        cd $i\r\n        <del>sudo -u apache<\/del> git pull\r\n        cd \/var\/www\/html\r\n        done\r\n\r\n<\/pre>\n<p>For 20 instances took 88 secs yay! ;)<\/p>\n<pre>real    1m28.599s\r\nuser    0m11.510s\r\nsys     0m5.070s\r\n<\/pre>\n<p>Now tell Moodle about the changes and run whatever is pending<\/p>\n<p>upgrade.sh<\/p>\n<pre>#!\/bin\/bash\r\n        for i in $( ls ); do\r\n            echo item: $i\r\n        sudo -u apache php $i\/admin\/cli\/upgrade.php --non-interactive\r\n        done\r\n<\/pre>\n<p>Nice it took almost four minutes to execute&#8230;<\/p>\n<pre>real    4m31.226s\r\nuser    2m36.918s\r\nsys     0m28.886s\r\n<\/pre>\n<p>Half of work done&#8230; time for a coffee, need to make this via ansible&#8230; still get no time to implement test |staging | production from staging to production rollback if breaks.<\/p>\n<p>As pointed by Gunnar in the comments the moodle source not really needs to have apache permissions opposed to moodledata where it need to write and create files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well its monday so semi auto magic roll of patches on CentOS via yum-cron on Debian broken for some dumb and strong firewall rules but applied via unattended updates now done through a ssh tunnel using tsocks, been thinking on &hellip; <a href=\"https:\/\/blografia.net\/vicm3\/2016\/11\/automagic-moodle-update\/\">Sigue leyendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[5,10,8,6],"tags":[678,403,50,677,155],"class_list":["post-1691","post","type-post","status-publish","format-standard","hentry","category-debraye","category-planetalinux","category-sysadmin","category-trabajo","tag-chores","tag-cli","tag-moodle","tag-scripts","tag-update"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1491,"url":"https:\/\/blografia.net\/vicm3\/2015\/10\/wp-cli\/","url_meta":{"origin":1691,"position":0},"title":"Wp-cli","author":"vicm3","date":"27 octubre, 2015","format":false,"excerpt":"Well Dreamhost sometime ago installed wp-cli [1] on their machines think of it like drush [2] and it's really fast and nice, managing wp via CLI is way easier and clean, yes I'm aware that for sometime now also there is WP multisite and other improvements but as I like\u2026","rel":"","context":"En \u00abGeneral\u00bb","block_context":{"text":"General","link":"https:\/\/blografia.net\/vicm3\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1537,"url":"https:\/\/blografia.net\/vicm3\/2016\/01\/bits-of-code-php-and-self-signed-cert-on-moodle\/","url_meta":{"origin":1691,"position":1},"title":"Bits of code, php and self signed cert on Moodle","author":"vicm3","date":"22 enero, 2016","format":false,"excerpt":"And a hack, if you happen to have a Moodle 2.6.x with phpmailer old library and you had php5.6.x you may find if you use ssl\/tls to send mail that now php is strictier with self signed certificates, well there are good documentation on php.net about [1] and [2] but\u2026","rel":"","context":"En \u00abEducaci\u00f3n\u00bb","block_context":{"text":"Educaci\u00f3n","link":"https:\/\/blografia.net\/vicm3\/category\/educacion\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":987,"url":"https:\/\/blografia.net\/vicm3\/2012\/12\/on-new-hard-disk-continued\/","url_meta":{"origin":1691,"position":2},"title":"On new hard disk continued","author":"vicm3","date":"2 diciembre, 2012","format":false,"excerpt":"Previously I wrote about getting and testing new disk one of the two ordered was sent to warranty the other was subject to stress test, well last Friday the faulty one was replaced with a new one from seller and begun stress test as this one replace one with less\u2026","rel":"","context":"En \u00abDebraye\u00bb","block_context":{"text":"Debraye","link":"https:\/\/blografia.net\/vicm3\/category\/debraye\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blografia.net\/vicm3\/wp-content\/uploads\/2012\/12\/df-day.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1104,"url":"https:\/\/blografia.net\/vicm3\/2013\/09\/svn-and-its-new-sqlite-format-again\/","url_meta":{"origin":1691,"position":3},"title":"SVN and its new sqlite format again","author":"vicm3","date":"10 septiembre, 2013","format":false,"excerpt":"I been a user of svn for a quite long time now, and had to work around certain \"features\", like berkeley.db locking on multiuser home directories, the migration to FS logs, and problems working with multi platform environments, most of it its documented on this blog. Yeah, git is sexy,\u2026","rel":"","context":"En \u00abDebraye\u00bb","block_context":{"text":"Debraye","link":"https:\/\/blografia.net\/vicm3\/category\/debraye\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1695,"url":"https:\/\/blografia.net\/vicm3\/2016\/11\/to-do\/","url_meta":{"origin":1691,"position":4},"title":"To do","author":"vicm3","date":"23 noviembre, 2016","format":false,"excerpt":"To do Get Debian to automagic update, by firewall rules is not possible, so ssh-key without pass, ssh tunnel, tsock on apt.conf invocation (try this week) Get a micro sim for my cel, solution for GSM network consisted on *#*# trick and key binding like of gamer Get more sleep!\u2026","rel":"","context":"En \u00abDebraye\u00bb","block_context":{"text":"Debraye","link":"https:\/\/blografia.net\/vicm3\/category\/debraye\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":922,"url":"https:\/\/blografia.net\/vicm3\/2012\/06\/the-sorry-state-of-moodle-on-debian\/","url_meta":{"origin":1691,"position":5},"title":"The sorry state of Moodle on Debian","author":"vicm3","date":"7 junio, 2012","format":false,"excerpt":"Well, yes I know, for starters i would be involved on the -team for Moodle, but it bug me out that the important security fixes takes really time to get out to stable, yes I know some are not that severe, but also 1.9.x that is currently on Stable (squeezy)\u2026","rel":"","context":"En \u00abEducaci\u00f3n\u00bb","block_context":{"text":"Educaci\u00f3n","link":"https:\/\/blografia.net\/vicm3\/category\/educacion\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/posts\/1691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/comments?post=1691"}],"version-history":[{"count":0,"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/posts\/1691\/revisions"}],"wp:attachment":[{"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/media?parent=1691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/categories?post=1691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blografia.net\/vicm3\/wp-json\/wp\/v2\/tags?post=1691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}