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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,374
Community Members
 
Community Events
176
Community Groups

Redirect redis server from localhost to http://service-name:port

 

Is it possible to redirect a service name from localhost to http://service-name: port

image: python:3.8

pipelines:
default:
- parallel:
- step:
name: Test
services:
- redis-server
caches:
- pip
script:
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- pip install pytest
- cd files
- python3 -m pytest -v tests/test_app.py
definitions:
services:
redis-server:
image: redis:3.2

app.py

 
from distutils.log import debug

from itertools import count

from flask import Flask,render_template

from flask_redis import FlaskRedis

count = 0

app = Flask(__name__)

app.config['REDIS_URL'] = "redis://redis-server:6379/0"

#app.config['REDIS_DB'] = 0

redisclient = FlaskRedis(app)

@app.route("/")

def helloworld():

# exit(1) #1 means with error 0 is with error

global count

count = count +1

redisclient.set("value1",count)

return "HelloWorld: {0}".format(redisclient.get("value1").decode("utf-8"))

@app.route("/hello")

def hello():

return render_template("index.html", placeholder = "hello demo for Panos")

if __name__ == "__main__":

app.run(debug=True,host="0.0.0.0",port=5000)

 

app_test.py

 

import unittest

import app

def test_main():

assert "HelloWorld:" in app.helloworld()

 

 

how do i redirect from localhost to redis-server ?

1 answer

0 votes

Hi @nacbapat 

Thank you for contacting Atlassian Community, I'm Norbert and I'm a Bitbucket Cloud Support Engineer, it's nice to meet with you! Welcome to the Atlassian Community!

Based on my observation, you would like to connect from your app to the redis service, which is running in Bitbucket Pipelines. As our documentation states, no port mapping or hostnames are required: https://confluence.atlassian.com/bitbucket/use-services-and-databases-in-bitbucket-pipelines-874786688.html

To connect, can I ask you to try to connect as: 

"redis://localhost:6379/0"

Please let us know how it goes.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events