Last active
March 16, 2025 10:20
-
-
Save shankar-bavan/ccc0d69e40f958e76aa23777871955f5 to your computer and use it in GitHub Desktop.
Revisions
-
shankar-bavan revised this gist
Mar 4, 2021 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -96,6 +96,9 @@ for centos for ubuntu `#!/bin/bash` Bash path must be same than results of: $ which bash ``` #!/bin/sh -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 8 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,25 +5,22 @@ https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ or `ssh-keygen` eval $(ssh-agent) `ssh-add ~/.ssh/<private_key_file>` Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Add Key copy public key `cat ~/.ssh/id_rsa.pub ` `ssh -T [email protected]` The command message tells you which of your Bitbucket accounts can log in with that key. If there any issues run below command (Permission denied (publickey)) `ssh-add -l` `ssh-add ~/.ssh/<private_key_file>` Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Known hosts Add IP address of the server and click on Fetch and Add Host @@ -32,10 +29,10 @@ Add IP address of the server and click on Fetch and Add Host ### 2. Update remote url Go to project directory `git remote -v` set ssh format url `git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ` ============================================================= -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -89,11 +89,13 @@ pipelines: COMMAND: "/var/folder-name/deploy.sh" ``` ``` =============================================================== ### 6. Sh script Note: for centos `#!/bin/sh` for ubuntu `#!/bin/bash` -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,7 @@ set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= ### 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Repository variables @@ -48,14 +49,18 @@ Value: 22 Name:SERVER Value: IP address untick secured =============================================================== ### 4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== ### 5. create file and copy below code. ``` -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Known hosts Add IP address of the server and click on Fetch and Add Host ============================================================= ### 2. Update remote url Go to project directory git remote -v @@ -38,7 +38,7 @@ set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= ### 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Repository variables Name: SSH_USER @@ -49,14 +49,14 @@ Name:SERVER Value: IP address untick secured =============================================================== ### 4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== ### 5. create file and copy below code. ``` # This is a sample build configuration for PHP. -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ### 1. Setup ssh key on server follow this guide https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ @@ -29,6 +30,7 @@ Add IP address of the server and click on Fetch and Add Host ============================================================= ## 2. Update remote url Go to project directory git remote -v @@ -47,13 +49,15 @@ Name:SERVER Value: IP address untick secured =============================================================== ## 4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== ## 5. create file and copy below code. ``` # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 22 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,19 @@ ### 1. Setup ssh key on server follow this guide https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ or ssh-keygen eval $(ssh-agent) ssh-add ~/.ssh/<private_key_file> ssh-add ~/.ssh/<private_key_file> Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Add Key copy public key cat ~/.ssh/id_rsa.pub @@ -17,6 +24,9 @@ If there any issues run below command (Permission denied (publickey)) ssh-add -l ssh-add ~/.ssh/<private_key_file> Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Known hosts Add IP address of the server and click on Fetch and Add Host ============================================================= ## 2. Update remote url Go to project directory @@ -27,8 +37,6 @@ git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= ## 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Repository variables Name: SSH_USER @@ -70,8 +78,19 @@ pipelines: #SSH_KEY: $MYKEY PORT: $PORT COMMAND: "/var/folder-name/deploy.sh" ``` ``` 6. Sh script Note: for centos `#!/bin/sh` ----------- for ubuntu `#!/bin/bash` ``` #!/bin/sh repos=( "/var/www/project1" "/var/www/project2" -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ### 1. Setup ssh key on server https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ ssh-keygen -
shankar-bavan revised this gist
Nov 23, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## 1. Setup ssh key on server https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ ssh-keygen @@ -18,15 +18,15 @@ ssh-add -l ssh-add ~/.ssh/<private_key_file> ============================================================= ## 2. Update remote url Go to project directory git remote -v set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= ## 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline @@ -45,7 +45,7 @@ Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== ## 5. create file and copy below code. ``` # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. -
shankar-bavan renamed this gist
Nov 23, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shankar-bavan revised this gist
Oct 26, 2020 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -71,3 +71,20 @@ pipelines: PORT: $PORT COMMAND: "/var/folder-name/deploy.sh" ``` 6. Sh script repos=( "/var/www/project1" "/var/www/project2" ) echo "" echo "Getting latest for" ${#repos[@]} "repositories using pull" for repo in "${repos[@]}" do echo "" echo "****** Getting latest for" ${repo} "******" cd "${repo}" git pull echo "******************************************" done -
shankar-bavan revised this gist
Oct 26, 2020 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ####1. Setup ssh key on server https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ ssh-keygen @@ -18,15 +18,15 @@ ssh-add -l ssh-add ~/.ssh/<private_key_file> ============================================================= ####2. Update remote url Go to project directory git remote -v set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= ####3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline @@ -39,14 +39,14 @@ Name:SERVER Value: IP address untick secured =============================================================== ####4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== ####5. create file and copy below code. ``` # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. # Only use spaces to indent your .yml configuration. @@ -69,5 +69,5 @@ pipelines: SERVER: $SERVER #SSH_KEY: $MYKEY PORT: $PORT COMMAND: "/var/folder-name/deploy.sh" ``` -
shankar-bavan revised this gist
Oct 26, 2020 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ <b>1. Setup ssh key on server</b> https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ ssh-keygen @@ -18,15 +18,15 @@ ssh-add -l ssh-add ~/.ssh/<private_key_file> ============================================================= <b>2. Update remote url</b> Go to project directory git remote -v set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= <b>3. Bitbucket pipeline settings (variables)</b> Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline @@ -39,13 +39,13 @@ Name:SERVER Value: IP address untick secured =============================================================== <b>4. Bitbucket pipeline settings (SSH Keys)</b> Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== <b>5. create file and copy below code.</b> # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. -
shankar-bavan revised this gist
Oct 26, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== 5. create file and copy below code. # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. # Only use spaces to indent your .yml configuration. @@ -70,4 +70,4 @@ pipelines: #SSH_KEY: $MYKEY PORT: $PORT COMMAND: "/var/folder-name/deploy.sh" -
shankar-bavan revised this gist
Oct 26, 2020 . 1 changed file with 32 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,6 +27,9 @@ git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Settings Enable pipeline Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Repository variables Name: SSH_USER Value : centos (server username) @@ -38,4 +41,33 @@ untick secured =============================================================== 4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys Click on Generate keys Copy public key to ~/.ssh/authorized_keys on the remote host (login to server and go to above path and edit file with nano and paste the public key in new line) =============================================================== 5. create file and copy below code. ``` # This is a sample build configuration for PHP. # Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples. # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: php:7.1.29 pipelines: branches: production: - step: name: Deploy to production deployment: production script: - echo "Deploying to production environment" - pipe: atlassian/ssh-run:0.2.2 variables: SSH_USER: $SSH_USER SERVER: $SERVER #SSH_KEY: $MYKEY PORT: $PORT COMMAND: "/var/folder-name/deploy.sh" ``` -
shankar-bavan created this gist
Oct 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ 1. Setup ssh key on server https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/ ssh-keygen eval $(ssh-agent) ssh-add ~/.ssh/<private_key_file> ssh-add ~/.ssh/<private_key_file> Go to Bitbucket -> repo -> repo-setting-> Access Keys -> Add Key copy public key cat ~/.ssh/id_rsa.pub ssh -T [email protected] The command message tells you which of your Bitbucket accounts can log in with that key. If there any issues run below command (Permission denied (publickey)) ssh-add -l ssh-add ~/.ssh/<private_key_file> ============================================================= 2. Update remote url Go to project directory git remote -v set ssh format url git remote set-url origin [email protected]:<workspace_ID>/<repo_name>.git ============================================================= 3. Bitbucket pipeline settings (variables) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> Repository variables Name: SSH_USER Value : centos (server username) Name: PORT Value: 22 Name:SERVER Value: IP address untick secured =============================================================== 4. Bitbucket pipeline settings (SSH Keys) Go to Bitbucket -> repo -> repo-setting-> -> Pipelines -> SSH Keys