Skip to content

Commit

Permalink
Merge branch 'main' into dev/add-parent-id
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankbrgowda committed Sep 23, 2024
2 parents 26d8a7d + 89ccf49 commit 138dc2c
Show file tree
Hide file tree
Showing 437 changed files with 44,238 additions and 28,327 deletions.
20 changes: 10 additions & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
ARG VARIANT=18-buster
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
FROM mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye

# Install MongoDB command line tools if on buster and x86_64 (arm64 not supported)
ARG MONGO_TOOLS_VERSION=5.0
RUN curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian $(lsb_release -cs)/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y mongodb-database-tools mongodb-mongosh \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Install MongoDB command line tools - though mongo-database-tools not available on arm64
ARG MONGO_TOOLS_VERSION=6.0
RUN . /etc/os-release \
&& curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian ${VERSION_CODENAME}/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y mongodb-mongosh \
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install -y mongodb-database-tools; fi \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down
42 changes: 25 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/javascript-node-mongo
// Update the VARIANT arg in docker-compose.yml to pick a Node.js version
// For format details, see https://aka.ms/devcontainer.json.
// For config options, see the README at:
// https://github.com/devcontainers/templates/tree/main/src/javascript-node-mongo
{
"name": "Apollo",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"mongodb.mongodb-vscode",
"arcanis.vscode-zipfs",
"eamodio.gitlens",
],
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"./git-autocomplete": "1.0.0",
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mongodb.mongodb-vscode",
"arcanis.vscode-zipfs",
"eamodio.gitlens",
],
},
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3999, 27017],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "yarn install && mongosh --eval 'try {rs.initiate();} catch {}'",
"postCreateCommand": "yarn install --immutable && mongosh --eval 'try {rs.initiate();} catch {}'",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
11 changes: 1 addition & 10 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
# Update 'VARIANT' to pick an LTS version of Node.js: 16, 14, 12.
# Append -bullseye or -buster to pin to an OS version.
# Use -bullseye variants on local arm64/Apple Silicon.
VARIANT: 18-buster

volumes:
- ..:/workspace:cached
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Uncomment the next line to use a non-root user for all processes.
# user: node

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

Expand Down
6 changes: 6 additions & 0 deletions .devcontainer/git-autocomplete/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Git Autocomplete",
"id": "git-autocomplete",
"version": "1.0.0",
"description": "Enable git autocomplete in the shell",
}
13 changes: 13 additions & 0 deletions .devcontainer/git-autocomplete/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
UPDATE_RC="${UPDATE_RC:-"true"}"
AUTOCOMPLETE_SOURCE="source /usr/share/bash-completion/completions/git"

if [ "${UPDATE_RC}" = "true" ]; then
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
if [[ "$(cat /etc/bash.bashrc)" != *"${AUTOCOMPLETE_SOURCE}"* ]]; then
echo -e "${AUTOCOMPLETE_SOURCE}" >> /etc/bash.bashrc
fi
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"${AUTOCOMPLETE_SOURCE}"* ]]; then
echo -e "${AUTOCOMPLETE_SOURCE}" >> /etc/zsh/zshrc
fi
fi
22 changes: 11 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ module.exports = {
'eslint:recommended',
'plugin:unicorn/recommended',
'plugin:cypress/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/strict',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:prettier/recommended',
],
plugins: ['tsdoc', 'sort-destructure-keys'],
plugins: ['import', 'tsdoc', 'sort-destructure-keys'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
Expand Down Expand Up @@ -41,6 +39,7 @@ module.exports = {
],
'no-console': ['warn', { allow: ['error', 'warn', 'debug'] }],
'no-else-return': ['error', { allowElseIf: false }],
'no-extra-semi': 'off',
'object-shorthand': 'warn',
'prefer-destructuring': 'warn',
'prefer-template': 'warn',
Expand All @@ -66,11 +65,16 @@ module.exports = {
'warn',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/restrict-template-expressions': [
'warn',
{ allowNumber: true },
],
'@typescript-eslint/return-await': 'error',
// eslint-plugin-import rules (override recommended)
// eslint-plugin-import rules
'import/export': 'error',
'import/no-duplicates': 'warn',
'import/no-extraneous-dependencies': 'error',
// eslint-plugin-prettier rules (override recommended)
'prettier/prettier': 'warn',
'import/no-named-as-default': 'warn',
// eslint-plugin-sort-destructure-keys rules
'sort-destructure-keys/sort-destructure-keys': 'warn',
// eslint-plugin-tsdoc rules
Expand All @@ -81,10 +85,6 @@ module.exports = {
'unicorn/no-null': 'off', // A lot of null in React and other libraries
'unicorn/prefer-module': 'off', // Cypress and apollo-collaboration-server need this
'unicorn/prevent-abbreviations': 'off', // Doesn't guess a lot of abbreviations correctly
// Special case @typescript-eslint/eslint-plugin rule
// Will be part of "plugin:@typescript-eslint/recommended-type-checked" when
// that extension is enabled. Remove from here at that time.
'@typescript-eslint/no-floating-promises': 'error',
},
overrides: [
// Only use React-specific lint rules in jbrowse-plugin-apollo
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cypress_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand All @@ -35,7 +35,7 @@ jobs:
LOG_LEVELS: error,warn,log,debug

- name: Archive test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: '!cancelled()'
with:
name: cypress_results
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Deploy to demo server

on:
workflow_call:
inputs:
environment:
required: true
type: string
workflow_dispatch:
inputs:
environment:
description: Environment to deploy
type: environment
required: true

jobs:
build:
name: Build and upload
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install
run: yarn --immutable
- name: Build plugin
run: yarn build
working-directory: packages/jbrowse-plugin-apollo
- name: Upload built plugin files
uses: actions/upload-artifact@v4
with:
name: plugin
path: |
packages/jbrowse-plugin-apollo/dist/jbrowse-plugin-apollo.umd.development.js
packages/jbrowse-plugin-apollo/dist/jbrowse-plugin-apollo.umd.production.min.js
deploy:
name: Deploy to ${{ inputs.environment }} demo server
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
needs: [build]
steps:
- name: Check out
uses: actions/checkout@v4
- name: Download built plugin files
uses: actions/download-artifact@v4
with:
name: plugin
path: .github/workflows/deploy/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Get instance address
id: ec2-describe-instances
run: |
INSTANCE_ADDRESS=$(aws ec2 describe-instances \
--instance-ids ${{ vars.INSTANCE_ID }} \
--query "Reservations[*].Instances[*].[PublicDnsName]" \
--output text)
echo "INSTANCE_ADDRESS=$INSTANCE_ADDRESS" >> "$GITHUB_OUTPUT"
- name: Set up SSH
run: |
mkdir --parents ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/staging
chmod 600 ~/.ssh/staging
cat >>~/.ssh/config <<END
Host staging
HostName ${{ steps.ec2-describe-instances.outputs.INSTANCE_ADDRESS }}
User ec2-user
IdentityFile ~/.ssh/staging
END
ssh-keyscan -H ${{ steps.ec2-describe-instances.outputs.INSTANCE_ADDRESS }} >> ~/.ssh/known_hosts
- name: Create Docker context
run: |
docker context create staging \
--docker host=ssh://staging \
--description "Staging server"
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
ROOT_USER_NAME: ${{ secrets.ROOT_USER_NAME }}
ROOT_USER_PASSWORD: ${{ secrets.ROOT_USER_PASSWORD }}
URL: ${{ vars.URL }}
DOCKER_TAG: ${{ vars.DOCKER_TAG }}
working-directory: .github/workflows/deploy
run: |
docker --context staging compose down
docker --context staging compose pull
docker --context staging compose up --build --detach
15 changes: 15 additions & 0 deletions .github/workflows/deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM httpd:alpine
ARG JBROWSE_VERSION
COPY ./httpd.conf /usr/local/apache2/conf/httpd.conf
COPY ./jbrowse-plugin-apollo.umd.development.js /usr/local/apache2/htdocs/
COPY ./jbrowse-plugin-apollo.umd.production.min.js /usr/local/apache2/htdocs/
COPY ./jbrowse-plugin-apollo.umd.production.min.js /usr/local/apache2/htdocs/apollo.js
WORKDIR /usr/local/apache2/htdocs/
RUN <<EOF
set -o errexit
set -o nounset
set -o pipefail
wget https://github.com/GMOD/jbrowse-components/releases/download/v$JBROWSE_VERSION/jbrowse-web-v$JBROWSE_VERSION.zip
unzip -o jbrowse-web-v$JBROWSE_VERSION.zip
rm jbrowse-web-v$JBROWSE_VERSION.zip
EOF
Loading

0 comments on commit 138dc2c

Please sign in to comment.