Roots Discourse

Key format for deployement using bitbucket

#1

Hello folks,

I’m learning how to deploy following the tutorial from Jason Lengstorf
https://code.lengstorf.com/learn-trellis-wordpress-roots/#part-vi-provision-the-production-server.
Running into an issue configuring trellis/group_vars/all/users.yml


as I’m using bitbucket I tried
https://bitbucket.org/api/1.0/users/mybitbucketusername/ssh-keys and
https://bitbucket.org/api/1.0/users/<my bitbucket username>/ssh-keys
but it’s throwing me this error
error
Could someone point me in the right direction to solve this issue ?
Thank you.

0 Likes

#2

I’m not sure if anyone has figured this out yet, I think you’d need to authenticate that request.

Any chance you could add the same SSH key you have on BitBucket to an account on GitHub? You could also reference a local file, or add your public key to the your repo and reference it like that:

      - "{{ lookup('file', 'keys/example.pub') }}" # This references trellis/keys/example.pub
0 Likes

#3

Thank you @benword for your reply,
the noob here didn’t understand what you meant with “You could also reference a local file, or add your public key to the your repo and reference it like that:”
- “{{ lookup(‘file’, ‘keys/example.pub’) }}” # This references trellis/keys/example.pub
but I started from scratch with a public github repo and was able to deploy http://178.128.197.220/.
However, it seems like bootstrap isn’t active but I guess I’ ll make another post in sage for that and not trellis.
On a side note, I would love to know how to proceed to deploy with a bitbucket private repo, if anyone knows how to do it?

0 Likes

#4

I use a different url for bitbucket…
https://api.bitbucket.org/1.0/users/mybitbucketusername/ssh-keys

0 Likes

#5

There’s no tricks to this - just use the BitBucket repo for your repo URL

This is the same URL the OP tried and it requires authentication. Have you figured out how to use this with Trellis?

0 Likes

#6

I reference a local file as suggested and it works fine with Trellis.

  • “{{ lookup(‘file’, ‘~/.ssh/example.pub’) }}”
0 Likes

#7

Thank you both for your replies @benword @blu,

I started again from scratch, cloning the root example project https://github.com/roots/roots-example-project.com
and init it as a bitbucket private repo and try to deploy on digitalocean.
the problem I encounter is not in group_vars/production/wordpress_sites.yml but in
group_vars/all/users/yml.
Mine look like this

Giving me this error when running ansible-playbook server.yml -e env=production

Failed to connect to bitbucket.keys at port 443: [Errno -2] Name or service
not known
failed: [46.101.206.192] (item=[{u’name’: u’admin’, u’groups’: [u’sudo’]}, u’https://@bitbucket.keys’]) => {“changed”: false, “item”: [{“groups”: [“sudo”], “name”: “admin”}, “https://@bitbucket.keys”]}

My question is : how am I suppose to write in users.yml my url to bitbucket account keys ?
I deployed successfully with a repo on github and a url pointing to my github account url key but I’m unsuccessful with bitbucket.

0 Likes

#8

@Tanuki Ignore the GitHub vs BitBucket part of things for keys. Think of https://github.com/username.keys as just a repository of your public SSH keys.

Use https://github.com/username.keys, where username is a GH account that has your public SSH key. This would be the same public key on your BitBucket account.

Then use your BitBucket repo for your repo URL as mentioned above :smiley:

0 Likes

#9

Allright ! Thank you @benword it’s working !
Not sure to understand the reason behind having to use github and not being able to do it only with a bitbucket account but at least it’s working and I can continue on my learning journey.
Thank you again for your help :smiley:

0 Likes

closed #10

This topic was automatically closed after 42 days. New replies are no longer allowed.

0 Likes