Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

getting error during deploying my python fast api project on digital ocean.

Siddhant Pandey June 7, 2023

image: python:3.9

pipelines:
default:
- step:
name: Install Dependencies
script:
- apt-get update && apt-get install -y python3-venv
- python3 -m venv venv
- source venv/bin/activate
- pip install --upgrade pip
- pip install -r requirements.txt

- step:
name: Deploy to DigitalOcean
deployment: production
script:
- apt-get update && apt-get install -y zip
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
- apt-get install -y rsync sshpass
- ssh-keyscan $BITBUCKET_VARIABLE_DIGITALOCEAN_SERVER_IP >> ~/.ssh/known_hosts
- rsync -az --exclude='.git/' . $BITBUCKET_VARIABLE_USERNAME@$BITBUCKET_VARIABLE_DIGITALOCEAN_SERVER_IP:$BITBUCKET_VARIABLE_REMOTE_PATH
- sshpass -p $BITBUCKET_VARIABLE_SERVER_PASSWORD ssh $BITBUCKET_VARIABLE_USERNAME@$BITBUCKET_VARIABLE_DIGITALOCEAN_SERVER_IP "cd $BITBUCKET_VARIABLE_REMOTE_PATH && source venv/bin/activate && pip install -r requirements.txt && python main.py"

definitions:
variables: // HERE  
BITBUCKET_VARIABLE_DIGITALOCEAN_SERVER_IP: "<digitalocean_server_ip>"
BITBUCKET_VARIABLE_SERVER_PASSWORD: "<server_password>"
BITBUCKET_VARIABLE_USERNAME: "<username>"
BITBUCKET_VARIABLE_REMOTE_PATH: "<remote_path>"

 

getting error during deploying my project on digital ocean i even dont know my pipeline code is even correct can someone please help . 

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 8, 2023

Hello @Siddhant Pandey and welcome to the Community!

I'm afraid that the syntax you are using in the YML file to define the variables is not correct. In Bitbucket Pipelines the environment variables you want to use are not defined in the YML file but in Repository Settings.

You can navigate to Repository Settings > Repository Variables and create the variables you want to pass to your build. There's also the option to set the variables as Secured so their values are masked from the logs. 

For more details on repository and workspace variables, you're also welcome to take a look at our Variables and Secrets documentation.

Also, a good way to validate if your YML file is using valid syntax and attributes is by using our pipelines validator which is available in the following link : 

Thank you, @Siddhant Pandey !

Patrik S

Siddhant Pandey June 22, 2023

thanks for your response but i am noob in building bitbucket-pipeline and really dont have knowledge of this now i am trying to a new format of pipeline can you suggest me necessary changes in my pipeline.

 

image: Python:3.9

pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y zip
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
- python root.py
- pipe: atlassian/rsync-deploy:0.2.0
variables:
USER: $DEPLOY_USER
SERVER: $DEPLOY_SERVER
REMOTE_PATH: $DEPLOY_PATH
LOCAL_PATH: '.'
SSH_KEY: $SSH_KEY

 

and what i have to fill in the variables please dont mind if it feels disturbing you if you can help me with any resources from which i can learn please also tell me that 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events