[SOLVED] Failed to activate your repository?

version: '2'

    image: drone/drone

  - 8080:8000
  - 9000
  - ./drone:/var/lib/drone/
restart: always
  - DRONE_OPEN=true
  - DRONE_HOST=http://localhost
  - DRONE_SECRET=511a89s1d9a81sd9a81sdasd1asd189

    image: drone/agent

command: agent
restart: always
  - drone-server
  - /var/run/docker.sock:/var/run/docker.sock
  - DRONE_SERVER=drone-server:9000
  - DRONE_SECRET=511a89s1d9a81sd9a81sdasd1asd189

this is my docker-compose file, i have correctly set all the authorization within the bitbucket oauth section, i can all my repositories… however when i try to enable any repository it shows the message:

Failed to activate your repository

There are no logs… im pretty sure i gave all the required permission for the bitbucket oAuth as described on the docs, does it matter if all my repositories are private? do i need to set anything special in this case?

I can see you are running Drone on localhost, based on your DRONE_HOST variable, which means Drone will (accurately) create webhooks using the localhost address. Unfortunately Bitbucket will error if you try to create a webhook for localhost. This issue is specific to Bitbucket and does not impact the other providers.

So the solution is to install your instance on a public IP or hostname. I recommend either using ngrok or digital ocean which has low cost servers that you can use for testing.


ahhhh thats it! … its working now… thanks!

hello , i have the same problem. can you tell me how to solve it ?
so thanks,

Your drone instance needs to be have a public IP, otherwise bitbucket wont be able to communicate with your drone instance, so either use localtunnel / ngrok for testing or get yourself a VPS somewhere

i have the same problem with github on localhost for testing.is it impossible?

ok,thanks you.I will try it.

The Drone server must be available at a public address; GitHub cannot send webhooks to a private address such as localhost, which means no build can ever be triggered. You should therefore use a service like ngrok, which provides a public address, if you want to test Drone locally with GitHub.

I was facing the same issue. I got a free plan to create a tunnel at webhookrelay.com.

Then I run my the docker container and it is working (the Failed to activate your repository is gone):

docker run \
  --volume=/var/lib/drone:/data \
  --env=DRONE_RPC_SECRET=... \
  --env=DRONE_SERVER_HOST=http://48ifgh1ddxwnpazx1ndaqe.webrelay.io \
  --env=DRONE_SERVER_PROTO=http \
  --publish=4000:80 \
  --publish=443:443 \
  --restart=always \
  --detach=true \
  --name=drone \