Skip to content

Commit 3c59a81

Browse files
authored
Merge pull request #248 from UW-Macrostrat/modernize-repo
Some fixes to prepare for production
2 parents 119141c + 43fd0b1 commit 3c59a81

File tree

108 files changed

+10138
-7935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+10138
-7935
lines changed

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MACROSTRAT_DATABASE=<database_url>
2+
# Useful for development
3+
NODE_TLS_REJECT_UNAUTHORIZED=1
4+
5+
# Optional database locations
6+
# - these are inferred automatically from MACROSTRAT_DATABASE if not set
7+
# - if they are not found, some routes will not work
8+
ELEVATION_DATABASE=<database_url>
9+
ALICE_DATABASE=<database_url>
10+
ROCKD_DATABASE=<database_url>
11+
WHOS_ON_FIRST_DATABASE=<database_url>

.github/workflows/build-image.yaml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@ on:
33
push:
44
branches: ["main"]
55
tags:
6-
- 'v*.*.*' # glob for semver tags (including prereleases)
6+
- "v*.*.*" # glob for semver tags (including prereleases)
77
pull_request:
88
branches: [main]
99

1010
jobs:
1111
docker:
1212
runs-on: ubuntu-latest
1313
steps:
14-
-
15-
name: Checkout
14+
- name: Checkout
1615
uses: actions/checkout@v3
1716
with:
18-
submodules: 'recursive'
19-
-
20-
name: Docker meta
17+
submodules: "recursive"
18+
- name: Docker meta
2119
id: meta
2220
uses: docker/metadata-action@v4
2321
with:
@@ -34,24 +32,21 @@ jobs:
3432
type=semver,pattern={{version}},suffix=-{{date 'YYYYMMDDHHmmss'}}
3533
flavor: |
3634
latest=false
37-
-
38-
name: Set up Docker Buildx
35+
- name: Set up Docker Buildx
3936
uses: docker/setup-buildx-action@v2
4037

41-
-
42-
name: Login to OSG DockerHub
38+
- name: Login to OSG DockerHub
4339
uses: docker/login-action@v2
4440
with:
4541
registry: hub.opensciencegrid.org
4642
username: ${{ vars.HARBOR_CLI_NAME }}
4743
password: ${{ secrets.HARBOR_CLI_SECRET }}
48-
-
49-
name: Build and push
44+
- name: Build and push
5045
uses: docker/build-push-action@v3
5146
with:
5247
context: .
5348
push: true
5449
tags: ${{ steps.meta.outputs.tags }}
5550
labels: ${{ steps.meta.outputs.labels }}
5651
cache-from: type=gha
57-
cache-to: type=gha,mode=max
52+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ npm-debug.log
1111
node_modules
1212
v1/node_modules/*
1313
v1/npm-debug.log
14-
v1/utilities/scripts/credentials.py
1514
.idea
16-
venv
1715

18-
!v1/credentials.ts
19-
v2/utilities/scripts/credentials.py
16+
v1/credentials.ts
2017

2118
.DS_Store
2219
.AppleDouble
@@ -31,3 +28,5 @@ Icon
3128
.Spotlight-V100
3229
.Trashes
3330
.yarn/install-state.gz
31+
32+
.env

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.yarn
2+
node_modules

.vscode/settings.json

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

.yarn/releases/yarn-4.0.2.cjs

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

.yarn/releases/yarn-4.9.1.cjs

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
nodeLinker: node-modules
22

3-
yarnPath: .yarn/releases/yarn-4.0.2.cjs
3+
yarnPath: .yarn/releases/yarn-4.9.1.cjs

Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
# We have to specify a new-ish version of Debian
22
# to make sure we don't use an out of date image
3-
FROM node:14-bullseye
3+
FROM node:20-bullseye
44

55
RUN apt-get -y update && \
66
apt-get -y install redis-tools postgresql-client && \
77
apt-get -y install ca-certificates supervisor
88

99
WORKDIR /code
1010

11-
#COPY ./v1/package.json /code/v1/
12-
#COPY ./v2/package.json /code/v2/
13-
COPY ./package.json package.json
11+
COPY ./package.json ./yarn.lock ./code/
1412

15-
RUN npm install
16-
#RUN npm --prefix v1 install
17-
RUN npm --prefix v2 install
13+
RUN yarn install
1814

1915
# We had to switch to native postgres bindings
2016
# (using the pg-native module) for the purposes

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ DOCKER_TAG = latest
33

44
.PHONY: build run stop clean
55

6+
# Get the current version from package.json
7+
VER := $(shell node -p "require('./package.json').version")
68

79
run:
810
docker build -t macrostrat-api .
911
docker run --env-file .env --rm -it -p 5000:5000 macrostrat-api
1012

13+
release:
14+
# Ensure that the repository is clean
15+
git diff-index --quiet HEAD --
16+
git tag -a v$(VER) -m "Version $(VER)"
17+
git push origin v$(VER)
1118

19+
format:
20+
# Format the code using Prettier
21+
yarn run prettier --write .

0 commit comments

Comments
 (0)