It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

User published source code location on bitbucket server ? Edited

Is anyone having an idea on, where exactly user pushed/published source-code will store on Bitbucket server?  

2 answers

2 accepted

0 votes
Answer accepted
Stephen Sifers Atlassian Team Mar 27, 2019

Hello Hanmanth and welcome to the Community!

Bitbucket stored any code within a git repository that is then stored within the file systems of the Bitbucket server. Additionally, Bitbucket will store the data within Bitbucket_HOME/Shared/Data/repositories/Repo-ID which won’t tell you exactly which repo that is. To match the ID to name, you will need to run a database query such as:

SELECT name, id FROM <DataBase>.repository;

Source documentation: Identifying a Repository on the Bitbucket Server.

This should assist with locating where the code is located within the folder structure along with matching the repo-ID to the repo names.

I hope this proves helpful and you’re able to locate when you’re looking for.

Regards,
Stephen Sifers

0 votes
Answer accepted

Thanks @Stephen Sifers 

Using the mentioned select query I am able to find the repository name along with the associated id.

but 

I am not finding the source code which is pushed to the remote repository [or] bitbucket server repository.

Please see below.

$ ls
1 106 112 12 126 135 139 143 147 152 156 160 164 171 175 179 185 2 26 3 4 62 68 71 76 8 90 95 99
101 108 113 120 128 136 140 144 148 153 157 161 165 172 176 182 186 22 27 30 43 63 69 72 77 80 92 96
102 109 115 121 132 137 141 145 149 154 158 162 167 173 177 183 187 23 28 31 52 65 7 73 78 81 93 97
103 110 118 122 134 138 142 146 150 155 159 163 170 174 178 184 188 24 29 33 53 66 70 74 79 88 94 98

$ cd 2/

$ ls
app-info config HEAD hooks logs objects packed-refs refs repository-config stash-refs

$ pwd
/var/atlassian/application-data/bitbucket/shared/data/repositories/2

 

I am seeing .git like directory structure in the repository(listed directories in bold) . Could you please let me know in which folder I can find the source code?  will it be seeable or will it be (source code) stored in a different format?

Stephen Sifers Atlassian Team Mar 28, 2019

Hello Hanmanth,

Looks like you’ve been able to locate your repos and associate a name to the numerical IDs. From the clarification you sent, it looks as you want to find the actual files within the git repos on the disk. This is not exactly how git works as the files are stored within the repo themselves. You won't be able to access the files within the repo directly as this could lead to a security issue or modifications outside of the tools.

If you’re wanting to gain access to the actual files within the repo, you will need to perform a git clone of the repo to then see the source files. Further information on cloning a repo locally may be found at Clone a repository.

I hope this proves helpful and you’re able to clone your repo locally to see the source files.

Regards,
Stephen Sifers

Hanmanth Reddy Patukuri Apr 11, 2019 • edited Apr 12, 2019

@Stephen Sifers ,

 

we are having 24/7 busy bitbucket server instance. so we are preferring for zero downtime backup and restore strategy.

we are using Postgres as a database for bitbucket server. we are good enough on taking backup of Postgres DB dump and restore.

But we are having issues with taking Bitbucket server home directory backup. Could you please provide any suggestion or scripts to taking bitbucket home directory server zero downtime backup.

we have hosted bitbucket server on xfs type file system(a file system volume capable of atomic /block level snapshots).

~]$ df -Th /var/atlassian/application-data/bitbucket/
Filesystem                       Type  Size   Used   Avail    Use%  Mounted on
/dev/mapper/rhel-root   xfs     47G   18G    29G      39%     /

Stephen Sifers Atlassian Team Apr 15, 2019

Hello Hanmanth,

Thank you for the follow up along with clarification on the issue you’re having with backing up your Bitbucket home directory.

Using Bitbucket Zero Downtime may not be 100% compatible with a script, mainly due to this type of backup requiring block level snapshots to comply with zero downtime. XFS us compatible with block-level snapshots so there should not be a problem there. There is a whole procedure on how to configured and approach zero downtime backups, I would like to include the content here but the article is much too large. Here are the articles I would suggest reviewing for zero downtime backup.

If you run into issues while going through those, please reach out again and let us know what's going on.

Regards,
Stephen Sifers

Hanmanth Reddy Patukuri Apr 15, 2019 • edited

Thank you Stephen, 

I have already gone through the above documentation, nowhere I find XFS dump/snapshot steps for bitbucket server home directory.

it would be helpful if we get any well-defined steps for this activity(Including xfs commands).

For example like below: 

xfs freeze  "bitbucket home directory file system" 

xfs dump  "bitbucket home directory file system" 

xfs unfreeze  "bitbucket home directory file system" 

Stephen Sifers Atlassian Team Apr 15, 2019

Hello Hanmanth,

Due to the nature and configuration which can be done using XFS block level snapshots along with the differences within Operating systems and version, Atlassian is unable to provide examples of how to use XFS snapshots. This is detailed within the Zero Downtime article sent above as follows:

  • Linux file system: LVM, XFS, and ZFS are all capable of taking block level snapshots. Refer to the documentation with your Linux distribution on how to script the snapshot and restore process. Atlassian does not provide examples or support for their use.

Reference Documentation: Block level file system snapshots | Read more about this...

I did find two reference documents which may assist in getting XFS snapshots up and running for your backups. We are unable to validate or test these documents, so ensure when testing you do so within a stagging or developer instance to avoid disruption to production.

I hope this proves helpful and you’re able to get your XFS snapshots up and running.

Regards,
Stephen Sifers

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,814 views 1 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you