From 17af28868f4d99231e0c25b99dab307a9f08a07f Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 09:18:50 -0700 Subject: [PATCH 1/2] 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 e3dac1826..26410fefc 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 79084a47e..95789c734 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 c08bd28eb7613e3a484376f07a052d4d6a130cb5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 6 Apr 2019 11:08:05 -0700 Subject: [PATCH 2/2] 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 c2b2bfec5..c11c9176a 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