Skip to content

Commit e5a9bf6

Browse files
authored
Merge pull request #698 from PecanProject/release/5.3.0
Release/5.3.0
2 parents 6ecba14 + 64dccb1 commit e5a9bf6

38 files changed

+630
-183
lines changed

.github/workflows/ci.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
9+
tags:
10+
- '*'
11+
12+
pull_request:
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
ruby:
21+
- 2.4
22+
- 2.5
23+
- 2.6
24+
# - 2.7 is not supported, results in error
25+
services:
26+
postgres:
27+
image: mdillon/postgis:9.5
28+
ports:
29+
- 5432:5432
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/cache@v1
38+
with:
39+
path: vendor/bundle
40+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
41+
restore-keys: |
42+
${{ runner.os }}-gems-
43+
- name: Set up Ruby ${{ matrix.ruby }}
44+
uses: actions/setup-ruby@v1
45+
with:
46+
ruby-version: ${{ matrix.ruby }}
47+
- name: Install libraries
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get -y install libgeos-dev
51+
- name: Install gems
52+
run: |
53+
gem install bundler -v 1.17.3
54+
bundle config path vendor/bundle
55+
bundle config without 'javascript_testing'
56+
bundle config with 'docker'
57+
bundle config
58+
bundle install --jobs 4 --retry 3
59+
- name: Build and test with Rake
60+
env:
61+
RAILS_ENV: test
62+
run: |
63+
cp config/database.yml.gh config/database.yml
64+
psql -h localhost -U postgres -c "CREATE USER bety WITH SUPERUSER CREATEDB UNENCRYPTED PASSWORD 'bety'";
65+
psql -h localhost -U postgres -c "DROP DATABASE IF EXISTS test;"
66+
psql -h localhost -U postgres -c "CREATE DATABASE test WITH OWNER bety;"
67+
psql -h localhost -U bety -d test -c "CREATE EXTENSION postgis;"
68+
#bundle exec rails db:create
69+
# bundle exec rails db:migrate
70+
bundle exec rake db:structure:load
71+
bundle exec rake db:fixtures:load
72+
mkdir -p spec/tmp
73+
bundle exec rails test
74+
bundle exec rspec --tag ~js
75+
76+
docker:
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v2
80+
- name: Build image
81+
run: docker build --tag image --file Dockerfile .

.github/workflows/dbdump.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: DB Dump
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
sync:
9+
if: github.repository == 'PecanProject/bety'
10+
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: mdillon/postgis:9.5
16+
ports:
17+
- 5432:5432
18+
options: >-
19+
--health-cmd pg_isready
20+
--health-interval 10s
21+
--health-timeout 5s
22+
--health-retries 5
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Setup Database
27+
run: |
28+
psql -h localhost -U postgres -c "CREATE ROLE bety WITH LOGIN CREATEDB NOSUPERUSER NOCREATEROLE PASSWORD 'bety'"
29+
psql -h localhost -U postgres -c "CREATE DATABASE bety WITH OWNER bety"
30+
psql -h localhost -U postgres -d bety -c "CREATE EXTENSION postgis;"
31+
32+
- name: Sync with EBI
33+
run: script/load.bety.sh -a "postgres" -p "-h localhost" -d "bety" -o bety -m 99 -r 0 -c -w https://ebi-forecast.igb.illinois.edu/pecan/dump/bety.tar.gz
34+
35+
- name: Sync with BU
36+
run: script/load.bety.sh -a "postgres" -p "-h localhost" -d "bety" -o bety -m 99 -r 1
37+
38+
- name: Sync with BNL
39+
run: script/load.bety.sh -a "postgres" -p "-h localhost" -d "bety" -o bety -m 99 -r 2 -w ftp://anon:[email protected]/outgoing/betydb/bety.tar.gz
40+
41+
- name: Sync with Wisconsin
42+
run: script/load.bety.sh -a "postgres" -p "-h localhost" -d "bety" -o bety -m 99 -r 5 -w http://tree.aos.wisc.edu:6480/sync/dump/bety.tar.gz
43+
44+
- name: Dump Database
45+
run: pg_dump -h localhost -U postgres -F c bety > initdb/db.dump
46+
47+
- name: Build Docker with Database dump
48+
run: |
49+
cd initdb
50+
docker build --tag image --file Dockerfile .
51+
52+
- name: Login into registry
53+
run: |
54+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
55+
if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" -a -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
56+
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
57+
fi
58+
59+
- name: Push docker image
60+
run: |
61+
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/db
62+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
63+
for T in $(date +'%Y-%V') 'latest'; do
64+
docker tag image $IMAGE_ID:$T
65+
docker push $IMAGE_ID:$T
66+
if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" -a -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
67+
docker tag image pecan/db:$T
68+
docker push pecan/db:$T
69+
fi
70+
done

.github/workflows/release.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
tags:
9+
- '*'
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Build image
17+
run: |
18+
docker build \
19+
--build-arg BETY_GIT_TAGS="$(git log --pretty=format:%d -1)" \
20+
--build-arg BETY_GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" \
21+
--build-arg BETY_GIT_CHECKSUM="$(git log --pretty=format:%H -1)" \
22+
--build-arg BETY_GIT_DATE="$(git log --pretty=format:%ad -1)" \
23+
--tag image --file Dockerfile .
24+
- name: Login into registry
25+
run: |
26+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
27+
if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" -a -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
28+
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
29+
fi
30+
- name: Push image
31+
run: |
32+
# image all lowercase
33+
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/bety
34+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
35+
36+
# Strip git ref prefix from version
37+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
38+
# Strip "v" prefix from tag name
39+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
40+
# Use Docker `latest` tag convention
41+
[ "$VERSION" == "master" ] && VERSION=latest
42+
43+
# all tags we will apply
44+
TMPVERSION="${VERSION}"
45+
OLDVERSION=""
46+
TAGS=""
47+
while [ "$OLDVERSION" != "$TMPVERSION" ]; do
48+
TAGS="${TAGS} ${TMPVERSION}"
49+
OLDVERSION="${TMPVERSION}"
50+
TMPVERSION=$(echo ${OLDVERSION} | sed 's/\.[0-9]*$//')
51+
done
52+
if [ "${TAGS}" == "" ]; then
53+
TAGS="test"
54+
fi
55+
if [ "${TAGS}" == "master" ]; then
56+
TAGS="latest"
57+
fi
58+
59+
echo IMAGE_ID=$IMAGE_ID
60+
echo VERSION=$VERSION
61+
echo TAGS=$TAGS
62+
63+
# push all images
64+
for T in $TAGS; do
65+
docker tag image $IMAGE_ID:$T
66+
docker push $IMAGE_ID:$T
67+
if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" -a -n "${{ secrets.DOCKERHUB_PASSWORD }}" ]; then
68+
docker tag image pecan/bety:$T
69+
docker push pecan/bety:$T
70+
fi
71+
done

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ config/initializers/site_keys.rb
2020
.Rproj.user
2121
public/assets
2222

23+
docker-compose.override.yml
24+
docker-compose.override.yaml
25+
2326
# Ignore encrypted secrets key file.
2427
config/secrets.yml.key

.travis.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,38 @@ section for the next release.
55

66
For more information about this file see also [Keep a Changelog](http://keepachangelog.com/) .
77

8+
## Migrations
9+
10+
Some of the changes require a migration. Depending on how you run BETY you can use one of the following options. No matter what, make sure you have a backup of your database before you do the migration, just in case.
11+
12+
### Native Install
13+
14+
You will need to install the latest version of BETY (or the version you want to migrate to), and run `rake db:migrate SKIP_SCHEMASPY=YES`.
15+
16+
### Docker (with docker compose)
17+
18+
In this case you can simply pull down the version you want, and run `docker-compose bety migrate`.
19+
820
## [Unreleased]
921

10-
### Fixes
22+
## [5.3.0] - 2020-04-15
1123

24+
### Fixes
25+
- #696 : actually now uses environment variable SECRET_KEY_BASE. If this was set, unset otherwise you can not login to BETY.
26+
- #551 : remove GUnload message from console on page change.
1227
- #672 : Added activemodel-serializers-xml Gem to restore functionality of "original" API XML endpoints.
1328
- #674 : Upgraded comma Gem to restore CSV file downloads.
29+
- use actual information in database for load and dump scripts.
30+
- update doi links http://dx.doi.org --> https://doi.org
31+
- fixed functions to explicitly add public. to function call and table reference. (this will require a migration)
32+
- upgrade rake to 13.0.1 (dependbot fix)
33+
- upgrade nokogiri to 1.10.8 (dependbot fix)
34+
35+
### Added
36+
- script to add new users to bety
37+
- dockerfile to dump database in docker image for faster restore of database.
38+
- switched to github actions instead of Travis
39+
- cronjob on github actions to create pecan/db docker image nightly, will safe also with year-weak (i.e 2020-15)
1440

1541
## [5.2.2] - 2019-12-06
1642

CITATION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Software
22

33
Scott Rohde; Carl Crott; Patrick Mulroony; Jeremy Kemball; David LeBauer; Jimmy Chen; Rob Kooper; Yilin Dong; Andrew Shirk; Zhengqi Yang; Uday Saraf; Michael Dietze.
4-
2014. BETYdb 3.2.3. [doi:10.5281/zenodo.11792](http://dx.doi.org/10.5281/zenodo.11792)
4+
2014. BETYdb 3.2.3. [doi:10.5281/zenodo.11792](https://doi.org/10.5281/zenodo.11792)
55

66
## Data
77

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ENV LOCAL_SERVER=99 \
4545
INITIALIZE_URL="-w https://ebi-forecast.igb.illinois.edu/pecan/dump/all/bety.tar.gz" \
4646
RAILS_ENV="production" \
4747
RAILS_RELATIVE_URL_ROOT="" \
48-
SECRET_KEY_BASE="ThisIsNotReallySuchAGreatSecret" \
48+
SECRET_KEY_BASE="thisisnotasecret" \
4949
UNICORN_WORKER_PROCESSES="3" \
5050
UNICORN_PORT="8000" \
5151
BETY_GIT_TAGS=${BETY_GIT_TAGS} \

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ GEM
113113
memoist (0.16.0)
114114
method_source (0.9.0)
115115
mini_mime (1.0.0)
116-
mini_portile2 (2.3.0)
116+
mini_portile2 (2.4.0)
117117
minitest (5.11.3)
118118
multi_json (1.13.1)
119119
mustache (1.0.5)
120120
narray (0.6.0.4)
121121
nio4r (2.3.0)
122-
nokogiri (1.8.5)
123-
mini_portile2 (~> 2.3.0)
122+
nokogiri (1.10.8)
123+
mini_portile2 (~> 2.4.0)
124124
passenger (5.3.4)
125125
rack
126126
rake (>= 0.8.1)
@@ -138,7 +138,7 @@ GEM
138138
public_suffix (3.0.2)
139139
rabl (0.13.1)
140140
activesupport (>= 2.3.14)
141-
rack (2.0.7)
141+
rack (2.0.8)
142142
rack-test (1.0.0)
143143
rack (>= 1.0, < 3)
144144
railroad (0.5.0)
@@ -171,7 +171,7 @@ GEM
171171
rake (>= 0.8.7)
172172
thor (>= 0.18.1, < 2.0)
173173
raindrops (0.19.0)
174-
rake (12.3.1)
174+
rake (13.0.1)
175175
rb-fsevent (0.10.3)
176176
rb-inotify (0.9.10)
177177
ffi (>= 0.5.0, < 2)

0 commit comments

Comments
 (0)