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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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% /
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephen, I came across this answer while trying to figure out how to query the source code. I saw that there is an API for it on BB Cloud edition, but we are on Data Center edition, which doesn't have an equivalent API, it seems. From your response and other information I've seen, I take it that there isn't a way to query (with SQL) the source code from the BitBucket database itself? (Note, I do not want to know where the source code files are on the server, as described above. I was hoping that the source code was in a compressed or similar format in the database itself, from which I could then query using SQL.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.