Git Setup Questions

Git Setup Questions

by Ali Errett -
Number of replies: 3

Hi,

I've got a basic understanding of Git and have read through the installation documentation, and looked at various posts on the forum about the different setups for Git, but it's all a little overwhelming. Could you give me some advice on how to best setup my Moodle site using Git.

I'm not planning on doing any mods to the Moodle core code, all I really want to do is create my own theme inline with my businesses branding. At the moment it's only me working on the project, but there may be more people in the future.

My understanding is that I need to fork the Git repo on Github and clone that to my local machine. The bit that confuses me is that i'm used to having a development site and a live stie. Do I need to setup both of these as remotes in Git? Secondly how to I actually get the Git repository onto my shared hosting/cPanel? I know a tiny bit about SSH, but that process confuses me too.

Sorry that there's so many questions, i'm just trying to get my head around it all.


Thanks

Ali

Average of ratings: -
In reply to Ali Errett

Re: Git Setup Questions

by Ken Task -
Picture of Particularly helpful Moodlers

Road block ... 'shared hosting' ... never enough.

If you don't program, think minimal ... that means no repo of your own.   It just adds a layer of complexity and moodle already has layers of complexity enough.

https://docs.moodle.org/310/en/Git_for_Administrators

The section on 'Obtaining the code from Git'.

Example: I have 2 bash shell scripts (that's why no shared hosting) one to update and one to upgrade - once the site is installed via git.

'up' script actually does a minimal site backup just prior to updating and is used to update core code .. not upgrade ... which uses a different set of git commands.

Example:  from a 3.5.x site ... that has Google Bucket for storage of bakups.

echo '3.5.14 (Build: 20200914)'
tar -cvf /mnt/data/backup/m35/moodle-code-3514-$(date +%Y%m%d%-H%M%S).tar ../moodle35;
tar -cvf /mnt/data/backup/m35/moodle-data-min-3514-$(date +%Y%m%d%-H%M%S).tar /var/www/moodle35data/filedir;
mysqldump -u root -p'password' moodle35ssl > /mnt/data/backup/m35/moodlessl3514-db-$(date +%Y%m%d%-H%M%S).sql;
ls -l /mnt/data/backup/m35/;
echo 'Paused ...';
read $keypress;
php admin/cli/cron.php;
php admin/cli/maintenance.php --enable;
git pull;
php admin/cli/upgrade.php --non-interactive;
php admin/cli/maintenance.php --disable;
php admin/cli/purge_caches.php;
chown apache:apache * -R
chown root:root ./up ./bu
fgrep '$release' version.php

Above for a LSB server.   Copy and paste at your own risk. ;)

My 2 'sense' ... nope said it right!

'SoS', Ken

In reply to Ken Task

Re: Git Setup Questions

by Ali Errett -
Ok, so when you say "Road block ... 'shared hosting' ... never enough.", are you saying I should just install Moodle via the installer and forget Git alltogether?
In reply to Ali Errett

Re: Git Setup Questions

by Ken Task -
Picture of Particularly helpful Moodlers

Shared hosting doesn't give you enough access and processing power.  Moodle not like WordPress, or Joomla, or Drupal.   It is memory 'hungry' and space 'hungry' if you build a site that becomes busy.

Do this with what you have ... go to your cPanel.   See if there is any tool that will allow you to 1) create a script (like the 'up' one I shared) and 2) execute it on demand.

What many shared hosting setups offer ... Softaculous and 'friends' ... 'one click wonders' that are commercial and in my humble opinion 'criminal' when they break ... hosting provider throws up their hands for support and tells you (the poor customer) to come over to these forums for resolution to the problems created by a commercial closed source utility that no one here can inspect to discover where it might have been programmed in-correctly.

If you are going to pursue git, then you need command line access.  Some cPanels have a terminal icon and that will put user into an ssh shell (command line) right in your home directory.   But then the 'fun' begins ... you discover you are in a 'jailed' environment ... no su to root, don't have superuser credentials to the DB server, and even a simple bash shell script (which is like a batch file on Windows) becomes a exercise in figuring out what works in a 'jail'.

Thus I have learned to equate: shared = jail/restricted/not enough resources for a Moodle.  shared = cheap ...  and one has to remember 'you get what you pay for!' ... hold true with 'shared'.

Again ... my '2 sense'!

'SoS', Ken