Skip to content

Commit

Permalink
Standardise all LB ports to start with 7
Browse files Browse the repository at this point in the history
In order to prevent conflicts when running multiple MeB projects, we
decided to isolate ports for each project.
Continues from bcc5836
  • Loading branch information
alastair committed Dec 3, 2021
1 parent 7d53e4c commit 42e72fd
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 22 deletions.
10 changes: 6 additions & 4 deletions docker/docker-compose.yml
Expand Up @@ -22,6 +22,8 @@ services:
image: timescale/timescaledb:2.2.0-pg11
volumes:
- timescaledb:/var/lib/postgresql/data:z
ports:
- "127.0.0.1:7432:5432"
environment:
POSTGRES_PASSWORD: 'postgres'

Expand Down Expand Up @@ -55,9 +57,9 @@ services:

api_compat:
image: web
command: python3 /code/listenbrainz/manage.py run_api_compat_server -h 0.0.0.0 -p 8080 -d
command: python3 /code/listenbrainz/manage.py run_api_compat_server -h 0.0.0.0 -p 7080 -d
ports:
- "8080:8080"
- "7080:7080"
volumes:
- ..:/code/listenbrainz:z
depends_on:
Expand Down Expand Up @@ -87,9 +89,9 @@ services:
image: web
volumes:
- ..:/code/listenbrainz:z
command: python manage.py run_websockets -h 0.0.0.0 -p 8082
command: python manage.py run_websockets -h 0.0.0.0 -p 7082
ports:
- "8082:8082"
- "7082:7082"
depends_on:
- redis
- rabbitmq
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/api-compat.rst
Expand Up @@ -53,7 +53,7 @@ For development
#. In Audacious, go to File > Settings > Plugins > Scrobbler2.0 and enable it. Now open its settings and then authenticate.

#. When you get a URL from your application which look like this ``http://last.fm/api/auth/?api_key=as3..234&..``, replace it with ``http://<HOSTURL>/api/auth/?api_key=as3..234&..``.
- If you are running a local server, then ``HOSTURL`` should be similar to "localhost:8080".
- If you are running a local server, then ``HOSTURL`` should be similar to "localhost:7080".
- If you are not running the server, then ``HOSTURL`` should be "api.listenbrainz.org".


Expand Down
4 changes: 2 additions & 2 deletions listenbrainz/api_compat.py
Expand Up @@ -12,8 +12,8 @@
"in config file.")
parser.add_argument("-t", "--host", default="0.0.0.0", type=str,
help="Which interfaces to listen on. Default: 0.0.0.0.")
parser.add_argument("-p", "--port", default="8080", type=int,
help="Which port to listen on. Default: 8080.")
parser.add_argument("-p", "--port", default="7080", type=int,
help="Which port to listen on. Default: 7080.")
args = parser.parse_args()
application.run(debug=True if args.debug else None,
host=args.host, port=args.port)
8 changes: 4 additions & 4 deletions listenbrainz/config.py.sample
Expand Up @@ -115,11 +115,11 @@ UPLOAD_FOLDER = "/tmp/lastfm-backup-upload"

# Set to "https://api.listenbrainz.org" if you want to work on frontend for user statistics
# without going through the process of generating the stats in local environment. Otherwise,
# set it to "http://localhost"
# set it to "http://localhost:7000"
API_URL = 'https://api.listenbrainz.org'
LASTFM_PROXY_URL = 'http://localhost:8080/'
SERVER_ROOT_URL = 'http://localhost'
WEBSOCKETS_SERVER_URL = 'http://localhost:8082'
LASTFM_PROXY_URL = 'http://localhost:7080/'
SERVER_ROOT_URL = 'http://localhost:7000'
WEBSOCKETS_SERVER_URL = 'http://localhost:7082'
MUSICBRAINZ_OAUTH_URL = 'https://musicbrainz.org/oauth2/userinfo'
LISTENBRAINZ_LABS_API_URL = 'https://labs.api.listenbrainz.org'

Expand Down
2 changes: 1 addition & 1 deletion listenbrainz/rtd_config.py
Expand Up @@ -71,7 +71,7 @@
UPLOAD_FOLDER = "/tmp/lastfm-backup-upload"

API_URL = 'https://api.listenbrainz.org'
LASTFM_PROXY_URL = 'http://0.0.0.0:8080/'
LASTFM_PROXY_URL = 'http://0.0.0.0:7080/'
MUSICBRAINZ_OAUTH_URL = 'https://musicbrainz.org/oauth2/userinfo'
SPOTIFY_CLIENT_ID = ''
SPOTIFY_CLIENT_SECRET = ''
Expand Down
Expand Up @@ -36,6 +36,6 @@
]
}
},
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"labsApiUrl": "http://0.0.0.0"
}
Expand Up @@ -32,7 +32,7 @@
"access_token": "access token",
"permission": ["streaming", "user-read-email", "user-read-private"]
},
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"searchLargerTimeRange": 0
}

Expand Up @@ -42,7 +42,7 @@
"access_token": "access token",
"permission": ["streaming", "user-read-email", "user-read-private"]
},
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"searchLargerTimeRange": 0
}

Expand Up @@ -841,7 +841,7 @@
"access_token": "access token",
"permission": ["streaming", "user-read-email", "user-read-private"]
},
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"searchLargerTimeRange": 0
}

Expand Up @@ -25,7 +25,7 @@
}
}
],
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"spotify": {
"access_token": "access token",
"permission": ["streaming", "user-read-email", "user-read-private"]
Expand Down
Expand Up @@ -725,7 +725,7 @@
}
}
],
"webSocketsServerUrl": "http://localhost:8082",
"webSocketsServerUrl": "http://localhost:7082",
"spotify": {
"access_token": "access token",
"permission": ["streaming", "user-read-email", "user-read-private"]
Expand Down
Expand Up @@ -7,5 +7,5 @@
"id": 2,
"name": "bob"
},
"webSocketsServerUrl": "http://localhost:8082"
"webSocketsServerUrl": "http://localhost:7082"
}
2 changes: 1 addition & 1 deletion listenbrainz/websockets/websockets.py
Expand Up @@ -50,7 +50,7 @@ def joined(data):
disconnect()


def run_websockets(host='0.0.0.0', port=8082, debug=True):
def run_websockets(host='0.0.0.0', port=7082, debug=True):
dispatcher = ListensDispatcher(app, socketio)
Thread(target=dispatcher.start).start()
socketio.run(app, debug=debug, host=host, port=port)
4 changes: 2 additions & 2 deletions manage.py
Expand Up @@ -33,7 +33,7 @@ def cli():

@cli.command(name="run_api_compat_server")
@click.option("--host", "-h", default="0.0.0.0", show_default=True)
@click.option("--port", "-p", default=8080, show_default=True)
@click.option("--port", "-p", default=7080, show_default=True)
@click.option("--debug", "-d", is_flag=True,
help="Turns debugging mode on or off. If specified, overrides "
"'DEBUG' value in the config file.")
Expand All @@ -51,7 +51,7 @@ def run_api_compat_server(host, port, debug=False):

@cli.command(name="run_websockets")
@click.option("--host", "-h", default="0.0.0.0", show_default=True)
@click.option("--port", "-p", default=8082, show_default=True)
@click.option("--port", "-p", default=7082, show_default=True)
@click.option("--debug", "-d", is_flag=True,
help="Turns debugging mode on or off. If specified, overrides "
"'DEBUG' value in the config file.")
Expand Down

0 comments on commit 42e72fd

Please sign in to comment.