Reload data on a demo server #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Reload data on a demo server | |
on: | |
workflow_call: | |
inputs: | |
environment: | |
description: Environment in which to reload data | |
type: string | |
required: true | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment in which to reload data | |
type: environment | |
required: true | |
jobs: | |
reload: | |
name: Clean up ${{ inputs.environment }} demo server | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- 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 | |
ServerAliveInterval 60 | |
ServerAliveCountMax 10 | |
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: Load data | |
run: | | |
# docker --context staging pull ghcr.io/gmod/apollo-cli:${{ vars.DOCKER_TAG }} | |
function apollo() { | |
docker \ | |
--context staging \ | |
run \ | |
--rm \ | |
--interactive \ | |
--add-host host.docker.internal=host-gateway \ | |
--volume /home/ec2-user/.config/apollo-cli:/root/.config/apollo-cli \ | |
--volume /home/ec2-user/data:/data \ | |
--env APOLLO_PROFILE=auto \ | |
ghcr.io/gmod/apollo-cli:${{ vars.DOCKER_TAG }} \ | |
"$@" | |
} | |
set -x | |
apollo config address http://host.docker.internal/apollo | |
apollo config accessType root | |
apollo config rootCredentials.username ${{ secrets.ROOT_USER_NAME }} | |
apollo config rootCredentials.password ${{ secrets.ROOT_USER_PASSWORD }} | |
apollo login --force | |
apollo jbrowse set-config /data/config.json | |
apollo assembly get | apollo assembly delete --verbose --assembly - | |
apollo file get | apollo file delete | |
apollo assembly \ | |
add-from-fasta \ | |
/data/schistosoma_haematobium.TD2_PRJEB44434.WBPS19.genomic.fa.gz \ | |
--fai /data/schistosoma_haematobium.TD2_PRJEB44434.WBPS19.genomic.fa.gz.fai \ | |
--gzi /data/schistosoma_haematobium.TD2_PRJEB44434.WBPS19.genomic.fa.gz.gzi \ | |
--assembly 'Schistosoma haematobium' | |
apollo assembly \ | |
add-from-fasta \ | |
/data/schistosoma_mansoni.PRJEA36577.WBPS19.genomic.fa.gz \ | |
--fai /data/schistosoma_mansoni.PRJEA36577.WBPS19.genomic.fa.gz.fai \ | |
--gzi /data/schistosoma_mansoni.PRJEA36577.WBPS19.genomic.fa.gz.gzi \ | |
--assembly 'Schistosoma mansoni' | |
apollo feature \ | |
import \ | |
/data/schistosoma_haematobium.TD2_PRJEB44434.WBPS19.annotations.genes.gff3 \ | |
--assembly 'Schistosoma haematobium' | |
apollo feature \ | |
import \ | |
/data/schistosoma_mansoni.PRJEA36577.WBPS19.annotations.genes.gff3 \ | |
--assembly 'Schistosoma mansoni' |