The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use mysql service inside my custom service in bitbucket-pipelines

Patha Shiva
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 28, 2020

Hi,


The below one is the bitbucket-pipelines.yml 

imageruby:2.4.5
options:  
size2x
pipelines:  
default:    
step: 
       
nameRunning Rspec        
caches:
          - bundler
          - yarn

script:

          - apt-get update
          - curl -sL https://deb.nodesource.com/setup_8.x | bash -
          - apt-get update && apt-get install -y nodejs
          - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
          - apt-get update
          - apt-get install -y yarn
          - apt-get install -y mutt
          - cp Gemfile.CI Gemfile
          - bundle install
          - yarn install
          - rspec
        services:
          - mysql
          - elasticsearch
          - docker
definitions:
  services:
    mysql:
      imagemysql:5.6
      environment:
        MYSQL_DATABASE"database_name"
        MYSQL_ROOT_PASSWORD"password"
    elasticsearch:
      memory4096
      imageelasticsearch:6.4.0
customservice:
image: customservice
  caches:
    bundler./vendor
    yarn./node_modules

 

 I need some way to connect my customservice to mysql service.

CustomService will start a rails container on spinning a container.

while starting the container it needs to connect to mysql service. I have tried configuring the host as 127.0.0.1, localhost, mysql in the database.yml. But nothing worked

Please help me if I am doing something wrong.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Radek Antoniuk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 29, 2020

How about running this directly via docker in the script section?
Also take note that there is a limitation that there is no mechanism waiting for the service startup.

Patha Shiva
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 29, 2020

Thanks for the reply.

My Customservice was able to connect to MySQL on localhost.

For that, I need to put some sleep time before I start the rails server.

Like Radek Antoniuk likes this
TAGS
AUG Leaders

Atlassian Community Events