Skip to content

Commit

Permalink
Added deployment method
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestkim authored Feb 9, 2023
1 parent 302697b commit d6eaa72
Showing 1 changed file with 49 additions and 9 deletions.
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
#### Authors: Forrest Kim, Jens Luebeck, Ted Liefeld, Edwin Huang, Thorin Tabor, Vineet Bafna
---

This is the main repository for the AmpliconRepository. Currently in development.
This is the main repository for the AmpliconRepository.

# How to set up the development server for AmpliconRepository
# How to set up a development server for AmpliconRepository

## Requirements
- Anaconda (https://www.anaconda.com/products/distribution)
- Python Virtual Environment

## 1. Clone the repository from GitHub
- Clone repo using https, ssh, or GitHub Desktop to your local machine

## 2. Set up the virtual environment and install packages:
- In a terminal window, move to the cloned Github repo
- Go to the caper top level directory (should see `environment.yml` and `requirements.txt`)
- Create a new Anaconda environment:
> `conda env create -f environment.yml`
- Go to the caper top level directory (should see `requirements.txt`)
- Create a new Python virtual environment:
> `python -m venv ampliconenv`
- Activate the new environment (you need to do this everytime before running the server):
> `conda activate caperenv`
- also need to "pip install opencv-python"
> `source ampliconenv/bin/activate`
- Install required packages
> `pip install -r requirements.txt`
## 3. Set up MongoDB locally (for development)
- If you don't have a database location set up, set up a location:
Expand All @@ -37,7 +38,6 @@ This is the main repository for the AmpliconRepository. Currently in development
- Note that the latest version of Compass (1.34.2) won't work with our older DB version. You can get an old compass for mac at https://downloads.mongodb.com/compass/mongodb-compass-1.28.4-darwin-x64.dmg

## 4. Set up secret keys for OAuth2
- Open a terminal window or tab with the `caperenv` environment active
- Make sure you have the `config.sh` file from another developer (this contains secret key information)
- Run the command to initialize variables:
`source config.sh`
Expand All @@ -49,3 +49,43 @@ This is the main repository for the AmpliconRepository. Currently in development
> `python manage.py runserver`
- Open the application on a web browser (recommend using a private/incognito window for faster development):
> https://localhost:8000

# How to deploy and update the server for AmpliconRepository
The server is currently running on an EC2 instance through Docker. The ports active on HTTP and HTTPS through AWS Load Balancer. There are two main scripts to start and stop the server.

## 1. How to start the server
- SSH into the EC2 instance (called `ampliconrepo-ubuntu-20.04`)
- this requires a PEM key
- Go to project directory
> `cd /home/ubuntu/caper/`
- Check to see if the Docker container is running
> `docker ps` (look for a container called amplicon)
- If it is not running, run the start script
> `./start-server.sh`
## 2. How to stop the server
- SSH into the EC2 instance (called `ampliconrepo-ubuntu-20.04`)
- this requires a PEM key
- Go to project directory
> `cd /home/ubuntu/caper/`
- Check to see if the Docker container is running
> `docker ps` (look for a container called amplicon)
- If it is running, run the stop script
> `./stop-server.sh`
## 3. How to update the server
- Clone repo using https, ssh, or GitHub Desktop to your local machine
- Make changes locally
- Push changes to the main branch of the repository
- SSH into the EC2 instance (called `ampliconrepo-ubuntu-20.04`)
- this requires a PEM key
- Go to project directory
> `cd /home/ubuntu/caper/`
- Pull your changes from Github
> `git pull origin main`
- Restart the server
> `./stop-server.sh`
> `./start-server.sh`

0 comments on commit d6eaa72

Please sign in to comment.