From c303110051cb6949831195689dc8a3bf1c91401c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 10:28:24 -0700 Subject: [PATCH 1/6] Travis --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5cba7..e7e6a73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,6 @@ before_script: before_install: - cd server script: - - cargo install diesel_cli --no-default-features --features postgres - - cargo build - - diesel migration run - cargo build --all - cargo test --all env: From ead065051c814a80652f215fcee10e66a9dcde1c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 10:36:16 -0700 Subject: [PATCH 2/6] Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index e7e6a73..f9249c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ before_script: before_install: - cd server script: + - cargo install diesel_cli -- force --no-default-features --features postgres + - diesel migration run - cargo build --all - cargo test --all env: From 011e34c3eb4fc398ca691aab17ce1d56406748e7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 10:49:27 -0700 Subject: [PATCH 3/6] Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f9249c1..26410fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_script: before_install: - cd server script: - - cargo install diesel_cli -- force --no-default-features --features postgres + - cargo install --force diesel_cli --no-default-features --features postgres - diesel migration run - cargo build --all - cargo test --all From be5bd77eec663c0e7b4f0bbf4292936e4e55c95e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 11:08:05 -0700 Subject: [PATCH 4/6] Adding health check to docker-compose. --- docker-compose.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c2b2bfe..c11c917 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.4' services: db: @@ -8,6 +8,11 @@ services: POSTGRES_USER: rrr POSTGRES_PASSWORD: rrr POSTGRES_DB: rrr + healthcheck: + test: ["CMD-SHELL", "pg_isready -U rrr"] + interval: 30s + timeout: 30s + retries: 3 lemmy: build: context: . @@ -17,6 +22,6 @@ services: environment: LEMMY_FRONT_END_DIR: /app/dist DATABASE_URL: postgres://rrr:rrr@db:5432/rrr - - links: - - db + depends_on: + db: + condition: service_healthy From d5e27a1059003228d49e57a63bee50b76f680e46 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 09:18:50 -0700 Subject: [PATCH 5/6] Fixing travis ci build - Fixes #39 Travis Travis Travis Travis Travis Travis Travis Travis Travis Travis Travis --- .travis.yml | 11 +++-------- .../2019-03-30-212058_create_post_view/up.sql | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3dac18..26410fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,22 @@ language: rust rust: - stable - - beta - - nightly matrix: allow_failures: - rust: nightly fast_finish: true -before_cache: - - cd server cache: cargo -services: - - postgresql before_script: - psql -c "create user rrr with password 'rrr' superuser;" -U postgres - psql -c 'create database rrr with owner rrr;' -U postgres before_install: - cd server script: - - cargo install diesel_cli --no-default-features --features postgres - - cargo build + - cargo install --force diesel_cli --no-default-features --features postgres - diesel migration run - cargo build --all - cargo test --all env: - DATABASE_URL=postgres://rrr:rrr@localhost/rrr +addons: + postgresql: "9.4" diff --git a/server/migrations/2019-03-30-212058_create_post_view/up.sql b/server/migrations/2019-03-30-212058_create_post_view/up.sql index 79084a4..95789c7 100644 --- a/server/migrations/2019-03-30-212058_create_post_view/up.sql +++ b/server/migrations/2019-03-30-212058_create_post_view/up.sql @@ -5,7 +5,7 @@ create or replace function hot_rank( returns integer as $$ begin -- hours_diff:=EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600 - return 10000*sign(score)*log(1 + abs(score)) / power(((EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600) + 2), 1.8); + return floor(10000*sign(score)*log(1 + abs(score)) / power(((EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600) + 2), 1.8))::integer; end; $$ LANGUAGE plpgsql; From 0decbe8e15e03d1e9cac591b50cbde88cac68b66 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 11:08:05 -0700 Subject: [PATCH 6/6] Adding health check to docker-compose. --- docker-compose.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c2b2bfe..c11c917 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '2.4' services: db: @@ -8,6 +8,11 @@ services: POSTGRES_USER: rrr POSTGRES_PASSWORD: rrr POSTGRES_DB: rrr + healthcheck: + test: ["CMD-SHELL", "pg_isready -U rrr"] + interval: 30s + timeout: 30s + retries: 3 lemmy: build: context: . @@ -17,6 +22,6 @@ services: environment: LEMMY_FRONT_END_DIR: /app/dist DATABASE_URL: postgres://rrr:rrr@db:5432/rrr - - links: - - db + depends_on: + db: + condition: service_healthy