Skip to content

Instantly share code, notes, and snippets.

@cdiaz
Forked from yosukehasumi/git-auto-deploy.md
Created January 29, 2018 15:27
Show Gist options
  • Select an option

  • Save cdiaz/7c8f6516dc6d75fde3ed25dab088f16a to your computer and use it in GitHub Desktop.

Select an option

Save cdiaz/7c8f6516dc6d75fde3ed25dab088f16a to your computer and use it in GitHub Desktop.

Revisions

  1. @yosukehasumi yosukehasumi revised this gist Mar 6, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -61,6 +61,11 @@ Add git-auto-deploy user to the www-data group
    usermod -a -G www-data git-auto-deploy
    ```

    For some reason I'm not so good with permission stuff and the above command doesn't work the way i expect, my solution is to change the ownership of the entire html directory
    ```
    chown -R git-auto-deploy:git-auto-deploy /var/www/html
    ```

    You may need to make sure that the repo IP fingerprint has been added to the ~/.ssh/known_hosts file and copy this to the git-auto-deploy/.ssh/known_hosts file
    ```
    ssh-keyscan -H -t rsa gitlab.pen.org >> ~/.ssh/known_hosts
  2. @yosukehasumi yosukehasumi revised this gist Mar 6, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -93,5 +93,9 @@ git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```

    To see git-auto-deploy logs you can watch the log file:
    ```
    tail -f /var/log/git-auto-deploy.log
    ```


  3. @yosukehasumi yosukehasumi revised this gist Mar 6, 2017. 1 changed file with 16 additions and 13 deletions.
    29 changes: 16 additions & 13 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -61,18 +61,6 @@ Add git-auto-deploy user to the www-data group
    usermod -a -G www-data git-auto-deploy
    ```

    Install git
    ```
    sudo apt-get install git
    ```

    You may need to verify the authenticity (fingerprint) of the git repo. In my case this was a Digital Ocean git repo so I ssh'd into my `/var/www/html` directory and ran
    ```
    git init
    git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```

    You may need to make sure that the repo IP fingerprint has been added to the ~/.ssh/known_hosts file and copy this to the git-auto-deploy/.ssh/known_hosts file
    ```
    ssh-keyscan -H -t rsa gitlab.pen.org >> ~/.ssh/known_hosts
    @@ -91,4 +79,19 @@ service git-auto-deploy status
    For Digital ocean you may have to open up the 8001 port
    ```
    sudo ufw allow 8001/tcp
    ```
    ```

    Install git
    ```
    sudo apt-get install git
    ```

    You may need to verify the authenticity (fingerprint) of the git repo. In my case this was a Digital Ocean git repo so I ssh'd into my `/var/www/html` directory and ran
    ```
    git init
    git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```



  4. @yosukehasumi yosukehasumi revised this gist Mar 1, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -90,5 +90,5 @@ service git-auto-deploy status

    For Digital ocean you may have to open up the 8001 port
    ```
    sudo ufw allow 8866/tcp
    sudo ufw allow 8001/tcp
    ```
  5. @yosukehasumi yosukehasumi revised this gist Mar 1, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -86,4 +86,9 @@ Start and check your git-auto-deploy server by running
    ```
    service git-auto-deploy start
    service git-auto-deploy status
    ```

    For Digital ocean you may have to open up the 8001 port
    ```
    sudo ufw allow 8866/tcp
    ```
  6. @yosukehasumi yosukehasumi revised this gist Mar 1, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,13 @@ git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```

    You may need to make sure that the repo IP fingerprint has been added to the ~/.ssh/known_hosts file and copy this to the git-auto-deploy/.ssh/known_hosts file
    ```
    ssh-keyscan -H -t rsa gitlab.pen.org >> ~/.ssh/known_hosts
    cp ~/.ssh/known_hosts /etc/git-auto-deploy/.ssh/
    chown git-auto-deploy:git-auto-deploy /etc/git-auto-deploy/.ssh/known_hosts
    ```

    Next make sure you add your public key from `/root/.ssh/id_rsa.pub` to gitlab and add a webhook that triggers the "push" event to http://mydomain.com:8001

    Start and check your git-auto-deploy server by running
  7. @yosukehasumi yosukehasumi revised this gist Feb 28, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -21,9 +21,9 @@ sudo apt-get install git-auto-deploy
    Modify /etc/git-auto-deploy.conf.json
    ```
    {
    "pidfilepath": "/etc/git-auto-deploy/.gitautodeploy.pid",
    "host": "0.0.0.0",
    "port": 8001,
    "pid-file": "/etc/git-auto-deploy/.gitautodeploy.pid",
    "http-host": "0.0.0.0",
    "http-port": 8001,
    "repositories": [
    {
    "url": "[email protected]:user/repo.git",
  8. @yosukehasumi yosukehasumi revised this gist Oct 26, 2016. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -71,4 +71,12 @@ You may need to verify the authenticity (fingerprint) of the git repo. In my cas
    git init
    git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```

    Next make sure you add your public key from `/root/.ssh/id_rsa.pub` to gitlab and add a webhook that triggers the "push" event to http://mydomain.com:8001

    Start and check your git-auto-deploy server by running
    ```
    service git-auto-deploy start
    service git-auto-deploy status
    ```
  9. @yosukehasumi yosukehasumi revised this gist Sep 8, 2016. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ Modify /etc/git-auto-deploy.conf.json
    "port": 8001,
    "repositories": [
    {
    "url": "git@gitlab.pen.org:penamerica/pen-dot-org-wp.git",
    "url": "git@gitlab.example.com:user/repo.git",
    "branch": "master",
    "remote": "origin",
    "path": "/var/www/html",
    @@ -65,3 +65,10 @@ Install git
    ```
    sudo apt-get install git
    ```

    You may need to verify the authenticity (fingerprint) of the git repo. In my case this was a Digital Ocean git repo so I ssh'd into my `/var/www/html` directory and ran
    ```
    git init
    git remote add origin [email protected]:user/repo.git
    git fetch origin
    ```
  10. @yosukehasumi yosukehasumi revised this gist Sep 8, 2016. 1 changed file with 27 additions and 9 deletions.
    36 changes: 27 additions & 9 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,22 @@
    Install software-properties-common
    `sudo apt-get install software-properties-common`
    ```
    sudo apt-get install software-properties-common
    ```

    Add Repo
    `sudo add-apt-repository ppa:olipo186/git-auto-deploy`
    ```
    sudo add-apt-repository ppa:olipo186/git-auto-deploy
    ```

    Update apt-get
    `sudo apt-get update`
    ```
    sudo apt-get update
    ```

    Install git-auto-deploy
    `sudo apt-get install git-auto-deploy`
    ```
    sudo apt-get install git-auto-deploy
    ```

    Modify /etc/git-auto-deploy.conf.json
    ```
    @@ -34,16 +42,26 @@ Modify /etc/git-auto-deploy.conf.json
    ```

    Generate key
    `cd /root/.ssh/; ssh-keygen -t rsa;`
    ```
    cd /root/.ssh/; ssh-keygen -t rsa;
    ```

    copy key to git-auto-deploy
    `sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/`
    ```
    sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/
    ```

    change permissions for script to git-auto-deploy user
    `sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy`
    ```
    sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy
    ```

    Add git-auto-deploy user to the www-data group
    `usermod -a -G www-data git-auto-deploy`
    ```
    usermod -a -G www-data git-auto-deploy
    ```

    Install git
    `sudo apt-get install git`
    ```
    sudo apt-get install git
    ```
  11. @yosukehasumi yosukehasumi revised this gist Sep 8, 2016. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,15 @@
    Install software-properties-common
    `sudo apt-get install software-properties-common`

    Add Repo
    `sudo add-apt-repository ppa:olipo186/git-auto-deploy`

    Update apt-get
    `sudo apt-get update`

    Install git-auto-deploy
    `sudo apt-get install git-auto-deploy`

    Modify /etc/git-auto-deploy.conf.json
    ```
    {
    @@ -31,11 +35,15 @@ Modify /etc/git-auto-deploy.conf.json

    Generate key
    `cd /root/.ssh/; ssh-keygen -t rsa;`

    copy key to git-auto-deploy
    `sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/`

    change permissions for script to git-auto-deploy user
    `sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy`

    Add git-auto-deploy user to the www-data group
    `usermod -a -G www-data git-auto-deploy`

    Install git
    `sudo apt-get install git`
  12. @yosukehasumi yosukehasumi revised this gist Sep 8, 2016. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@

    Install software-properties-common
    `sudo apt-get install software-properties-common`
    Add Repo
    `sudo add-apt-repository ppa:olipo186/git-auto-deploy`
    Update apt-get
    `sudo apt-get update`

    Install git-auto-deploy
    `sudo apt-get install git-auto-deploy`

    Modify /etc/git-auto-deploy.conf.json

    ```
    {
    "pidfilepath": "/etc/git-auto-deploy/.gitautodeploy.pid",
    @@ -29,10 +29,13 @@ Modify /etc/git-auto-deploy.conf.json
    }
    ```

    Generate key
    `cd /root/.ssh/; ssh-keygen -t rsa;`
    copy key to git-auto-deploy
    `sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/`
    change permissions for script to git-auto-deploy user
    `sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy`

    Add git-auto-deploy user to the www-data group
    `usermod -a -G www-data git-auto-deploy`

    Install git
    `sudo apt-get install git`
  13. @yosukehasumi yosukehasumi revised this gist Sep 8, 2016. 1 changed file with 12 additions and 9 deletions.
    21 changes: 12 additions & 9 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,13 @@
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:olipo186/git-auto-deploy
    sudo apt-get update

    sudo apt-get install git-auto-deploy
    `sudo apt-get install software-properties-common`
    `sudo add-apt-repository ppa:olipo186/git-auto-deploy`
    `sudo apt-get update`

    `sudo apt-get install git-auto-deploy`

    Modify /etc/git-auto-deploy.conf.json

    ```
    {
    "pidfilepath": "/etc/git-auto-deploy/.gitautodeploy.pid",
    "host": "0.0.0.0",
    @@ -25,11 +27,12 @@ Modify /etc/git-auto-deploy.conf.json
    }
    ]
    }
    ```

    cd /root/.ssh/; ssh-keygen -t rsa;
    sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/
    sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy
    `cd /root/.ssh/; ssh-keygen -t rsa;`
    `sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/`
    `sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy`

    usermod -a -G www-data git-auto-deploy
    `usermod -a -G www-data git-auto-deploy`

    sudo apt-get install git
    `sudo apt-get install git`
  14. @yosukehasumi yosukehasumi created this gist Sep 8, 2016.
    35 changes: 35 additions & 0 deletions git-auto-deploy.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:olipo186/git-auto-deploy
    sudo apt-get update

    sudo apt-get install git-auto-deploy

    Modify /etc/git-auto-deploy.conf.json

    {
    "pidfilepath": "/etc/git-auto-deploy/.gitautodeploy.pid",
    "host": "0.0.0.0",
    "port": 8001,
    "repositories": [
    {
    "url": "[email protected]:penamerica/pen-dot-org-wp.git",
    "branch": "master",
    "remote": "origin",
    "path": "/var/www/html",
    "filters": [
    {
    "object_kind": "push",
    "ref": "refs/heads/master"
    }
    ]
    }
    ]
    }

    cd /root/.ssh/; ssh-keygen -t rsa;
    sudo cp /root/.ssh/id_rsa /etc/git-auto-deploy/.ssh/
    sudo chown -R git-auto-deploy:git-auto-deploy /etc/git-auto-deploy

    usermod -a -G www-data git-auto-deploy

    sudo apt-get install git