-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #556 from metabrainz/master
Merge master into production
- Loading branch information
Showing
145 changed files
with
13,099 additions
and
1,540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,5 @@ pyvenv.cfg | |
.venv | ||
pip-selfcheck.json | ||
|
||
# Javascript | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
FROM metabrainz/python:3.6 | ||
FROM metabrainz/python:3.7 | ||
|
||
ARG deploy_env | ||
|
||
ENV DOCKERIZE_VERSION v0.2.0 | ||
ENV DOCKERIZE_VERSION v0.6.1 | ||
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | ||
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
|
||
|
@@ -27,25 +27,36 @@ RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends postgresql-client-$PG_MAJOR \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install uWSGI==2.0.13.1 | ||
RUN pip3 install uWSGI==2.0.18 | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
|
||
# MessyBrainz | ||
RUN git clone https://github.com/metabrainz/messybrainz-server.git messybrainz | ||
WORKDIR /code/messybrainz | ||
RUN git checkout production | ||
RUN pip3 install -r requirements.txt | ||
RUN python3 setup.py install | ||
|
||
# ListenBrainz | ||
WORKDIR /code/listenbrainz | ||
COPY ./requirements.txt . | ||
RUN pip3 install -r requirements.txt | ||
RUN pip3 install setuptools==36.0.1 | ||
|
||
# Node | ||
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | ||
apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* | ||
RUN mkdir /static | ||
WORKDIR /static | ||
COPY package.json package-lock.json webpack.config.js ./listenbrainz/webserver/static /static/ | ||
RUN npm install && npm run build:prod && ./node_modules/less/bin/lessc --clean-css /static/css/main.less > /static/css/main.css && \ | ||
rm -rf node_modules js/*.jsx *.json webpack.config.js && npm cache clean --force | ||
|
||
COPY . /code/listenbrainz | ||
WORKDIR /code/listenbrainz | ||
RUN rm -rf ./listenbrainz/webserver/static/ | ||
|
||
|
||
# Sometimes the local copy of config.py[c] gets in the way. Better nuke it to not conflict. | ||
RUN rm -f /code/listenbrainz/listenbrainz/config.py /code/listenbrainz/listenbrainz/config.pyc | ||
|
@@ -64,18 +75,6 @@ RUN touch /var/log/stats.log /var/log/dump_create.log && chown listenbrainz:list | |
# http://smarden.org/runit/runsv.8.html | ||
RUN touch /etc/service/cron/down | ||
|
||
# Node | ||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - | ||
RUN apt-get install -y nodejs | ||
RUN npm install -g [email protected] | ||
RUN npm install less-plugin-clean-css | ||
|
||
# Compile the CSS | ||
# Note: this will not persist because /code/listenbrainz is a volume | ||
# After bringing up a container, run this again inside the container | ||
# to compile the less files | ||
RUN lessc --clean-css listenbrainz/webserver/static/css/main.less > listenbrainz/webserver/static/css/main.css | ||
|
||
# Consul Template service is already set up with the base image. | ||
# Just need to copy the configuration. | ||
COPY ./docker/consul-template.conf /etc/consul-template.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM node:10.15-alpine | ||
|
||
RUN mkdir /code | ||
WORKDIR /code | ||
|
||
COPY package.json package-lock.json webpack.config.js /code/ | ||
RUN npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CREATE EXTENSION "uuid-ossp"; | ||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
BEGIN; | ||
|
||
CREATE TABLE spotify_auth ( | ||
user_id INTEGER NOT NULL, -- PK and FK to user.id | ||
user_token VARCHAR NOT NULL, | ||
token_expires TIMESTAMP WITH TIME ZONE, | ||
refresh_token VARCHAR NOT NULL, | ||
last_updated TIMESTAMP WITH TIME ZONE, | ||
latest_listened_at TIMESTAMP WITH TIME ZONE, | ||
active BOOLEAN DEFAULT TRUE, | ||
error_message VARCHAR | ||
); | ||
|
||
ALTER TABLE spotify_auth ADD CONSTRAINT spotify_auth_user_id_foreign_key FOREIGN KEY (user_id) REFERENCES "user" (id); | ||
ALTER TABLE spotify_auth ADD CONSTRAINT spotify_auth_pkey PRIMARY KEY (user_id); | ||
CREATE INDEX latest_listened_at_spotify_auth ON spotify_auth (latest_listened_at DESC NULLS LAST); | ||
|
||
COMMIT; |
12 changes: 12 additions & 0 deletions
12
admin/sql/updates/2018-11-17-add-on-delete-cascade-to-spotify-fk.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE spotify_auth | ||
DROP CONSTRAINT spotify_auth_user_id_foreign_key; | ||
|
||
ALTER TABLE spotify_auth | ||
ADD CONSTRAINT spotify_auth_user_id_foreign_key | ||
FOREIGN KEY (user_id) | ||
REFERENCES "user" (id) | ||
ON DELETE CASCADE; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BEGIN; | ||
|
||
-- Add column for alternative user id for login purpose to user table | ||
ALTER TABLE "user" ADD COLUMN user_login_id UUID NOT NULL DEFAULT uuid_generate_v4(); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
BEGIN; | ||
|
||
-- rename active to record_listens | ||
ALTER TABLE spotify_auth RENAME active TO record_listens; | ||
|
||
-- add column permission to table | ||
ALTER TABLE spotify_auth ADD COLUMN permission VARCHAR; | ||
-- set value to 'user-read-recently-played' for all current users | ||
UPDATE spotify_auth | ||
SET permission = 'user-read-recently-played'; | ||
-- set the column as not null | ||
ALTER TABLE spotify_auth ALTER COLUMN permission SET NOT NULL; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE "user" DROP COLUMN user_login_id; | ||
ALTER TABLE "user" ADD COLUMN login_id TEXT NOT NULL DEFAULT uuid_generate_v4()::text; | ||
|
||
UPDATE "user" | ||
SET login_id = id::text; | ||
|
||
ALTER TABLE "user" ADD CONSTRAINT user_login_id_key UNIQUE (login_id); | ||
CREATE UNIQUE INDEX login_id_ndx_user ON "user" (login_id); | ||
|
||
COMMIT; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BEGIN; | ||
|
||
CREATE TABLE follow_list ( | ||
id SERIAL, -- PK | ||
name TEXT NOT NULL, | ||
creator INTEGER NOT NULL, -- FK to "user".id | ||
private BOOLEAN NOT NULL DEFAULT FALSE, | ||
members INTEGER ARRAY NOT NULL DEFAULT ARRAY[]::INTEGER[], | ||
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), | ||
last_saved TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() | ||
); | ||
|
||
ALTER TABLE follow_list ADD CONSTRAINT follow_list_name_creator_key UNIQUE (name, creator); | ||
ALTER TABLE follow_list ADD CONSTRAINT follow_list_pkey PRIMARY KEY (id); | ||
|
||
ALTER TABLE follow_list | ||
ADD CONSTRAINT follow_list_user_id_foreign_key | ||
FOREIGN KEY (creator) | ||
REFERENCES "user" (id) | ||
ON DELETE CASCADE; | ||
|
||
CREATE INDEX creator_ndx_follow_list ON follow_list (creator); | ||
CREATE INDEX last_saved_ndx_follow_list ON follow_list (last_saved DESC); | ||
|
||
COMMIT; |
Oops, something went wrong.