Skip to main content

Problem getting site to work with Git repo

Comments

22 comments

  • bgarrant
    Been looking all morning and kind find an answer. Can anyone provide any advice?
    0
  • bgarrant
    Have you seen this documentation?
    0
  • bgarrant
    Have you seen this documentation?
    0
  • bgarrant
    I am trying to do this in such a way to not break cPanel on upgrades, migrations, etc.. Looking for the approved method. That help doc is missing a final step showing how to make the project/example the LIVE website. How should we do this? Should we use a CRON to copy the repo to the public_html folder or something? I know you can adjust the document root, but I heard it can break upgrades and also won't work with cPanel migration tools, etc.. I was told you should not do this. Is there a better way that will no break cPanel features? You must edit the file: /var/cpanel/userdata/USERNAME/DOMAIN.COM /var/cpanel/userdata/USERNAME/DOMAIN.COM_SSL and change the line: documentroot: /home/USERNAME/public_html to documentroot: /home/USERNAME/project/example and then run: /scripts/rebuildhttpdconf service httpd restart
    0
  • cPanelAdamF
    In an ideal world, your domain.com would be an addon domain, not the primary domain you started the account with. Then the document root location would be manageable from the Addon Domains feature. I realize that's not the most helpful thing in the world, but that's the migration-safe upgrade-safe canonical way to do it. I apologize that we don't make that clear in our communication. (WILL FIX) As an aside, we are currently working on the Allow users to install websites from version control feature for v72 and later which would embrace what you're trying to do by deploying your work via git. Would you like to be a part of the beta program for our work and play with our work before release?
    0
  • cPanelAdamF
    It occurs to me as I think about this more...and as I talk this out with my peers here inside cPanel and read up on Statamatic...that, if there's the means to tell Statamatic to render into ~/public_html (rather than $PROJECT_ROOT/public, it's default behavior), you could git-clone your project into your ~ and that would have the net-effect you want.
    0
  • bgarrant
    It occurs to me as I think about this more...and as I talk this out with my peers here inside cPanel and read up on Statamatic...that, if there's the means to tell Statamatic to render into ~/public_html (rather than $PROJECT_ROOT/public, it's default behavior), you could git-clone your project into your ~ and that would have the net-effect you want.

    I was able to PUSH into the /public_html just fine. Everything is in document root and protected with .htaccess. Looks good so far. The .git directory is also in that directory but htaccess is set to protect it. Can"t wait for the new Git features in cPanel.
    0
  • cPanelAdamF
    is your PROJECT_ROOT also your DOCUMENT_ROOT? The option I was describing would look something like: PROJECT_ROOT = ~ STATAMATIC_PUBLIC_DIR = ~/public_html GIT_WORKING_TREE = ~ DOCUMENT_ROOT = ~/public_html ...if that makes sense.
    0
  • bgarrant
    is your PROJECT_ROOT also your DOCUMENT_ROOT? The option I was describing would look something like: PROJECT_ROOT = ~ STATAMATIC_PUBLIC_DIR = ~/public_html GIT_WORKING_TREE = ~ DOCUMENT_ROOT = ~/public_html ...if that makes sense.

    At the moment I have it like this...Everything is in the document root ~/public_html. Is there a better way? public_html (document root) |--local |--assets |--index.php |--.htaccess |--site |--statamic |--please |--.gitignore
    0
  • bgarrant
    is your PROJECT_ROOT also your DOCUMENT_ROOT? The option I was describing would look something like: PROJECT_ROOT = ~ STATAMATIC_PUBLIC_DIR = ~/public_html GIT_WORKING_TREE = ~ DOCUMENT_ROOT = ~/public_html ...if that makes sense.

    This page explains it better: Installing Statamic - Statamic 2 Docs
    0
  • bgarrant
    is your PROJECT_ROOT also your DOCUMENT_ROOT? The option I was describing would look something like: PROJECT_ROOT = ~ STATAMATIC_PUBLIC_DIR = ~/public_html GIT_WORKING_TREE = ~ DOCUMENT_ROOT = ~/public_html ...if that makes sense.

    A bare repo works but you can"t commit or pull from it
    0
  • bgarrant
    In an ideal world, your domain.com would be an addon domain, not the primary domain you started the account with. Then the document root location would be manageable from the Addon Domains feature. I realize that's not the most helpful thing in the world, but that's the migration-safe upgrade-safe canonical way to do it. I apologize that we don't make that clear in our communication. (WILL FIX) As an aside, we are currently working on the
    0
  • cPanelAdamF
    Your link led me to Installing and running above webroot - Knowledge Base - Statamic 2 Docs and that's kinda more of what I was talking about. HOWEVER it sounds like you're good to go with the set up you've gotten to so no need to change it.
    0
  • bgarrant
    Your link led me to
    0
  • bgarrant
    Your link led me to
    0
  • cPanelAdamF
    wouldn't the entire contents of the user folders get downloaded on each PULL?

    No. Only the things checked into the git repository would come down when you perform a git-pull from another machine.
    Would I need to add all those extra directories to my .gitignore?

    well yes. So it's mildly complicated but basically you'll want to list any paths you don't want git to care about in the .gitignore so that changes in those areas aren't reported as unstaged. I'm not sure what Statamatic's recommendations are for a .gitignore but it's pretty typical for tools like Statamatic to publish a good starting example .gitignore. If Statamatic is rendering content into the $PROJECT_ROOT/public folder, then I bet it would need to be listed in your .gitignore...but, again, you're more of a Statamatic expert than I.
    0
  • bgarrant
    No. Only the things checked into the git repository would come down when you perform a git-pull from another machine. well yes. So it's mildly complicated but basically you'll want to list any paths you don't want git to care about in the .gitignore so that changes in those areas aren't reported as unstaged. I'm not sure what Statamatic's recommendations are for a .gitignore but it's pretty typical for tools like Statamatic to publish a good starting example .gitignore. If Statamatic is rendering content into the $PROJECT_ROOT/public folder, then I bet it would need to be listed in your .gitignore...but, again, you're more of a Statamatic expert than I.

    So I need to install a website with Git and some of the site will be above the docroot and some in public_html folder. Can I do this with the new beta version v72? If so can I get access to the beta? I am using latest stable release.
    0
  • bgarrant
    I am looking to set up the site like this if possible with Git. Is this how new v72 version works? I want some files above docroot after all. Trying to do this Installing and running above webroot - Knowledge Base - Statamic 2 Docs public_html |--assets |--index.php |--.htaccess site statamic please .gitignore I could PUSH to the ~/ right now, but I would need to add all the other cPanel folders to my .gitignore like access-logs, mail, etc, logs so I can perform commits correct? Is this best way?
    0
  • bgarrant
    I ended up making a git repo right in the ~/ and then I could have some files above webroot. I then excluded all the cPanel folders and files from my repo like this: .gitignore file .DS_Store .env node_modules/ installer.php # cPanel /.cpanel/ /.cphorde/ /.htpasswds/ /.ssh/ /.trash/ access-logs /etc/ /logs/ /mail/ /perl5/ /public_ftp/ /public_html/error_log /ssl/ /tmp/ www /.bash_history /.bash_logout /.bash_profile /.bashrc /.contactemail /.gitconfig /.lastlogin /.viminfo /.zshrc
    So far all seems to be working well. I think I could also do it the reverse way only "include" the folders I want correct? Less typing probably this way, but I have not tested it. /* !/assets !/statamic
    0
  • bgarrant
    What is the issue with changing document root on primary domain? What will it mess up? I was going to use this method
    0

Please sign in to leave a comment.