Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Deployment #86

Merged
merged 12 commits into from
Nov 18, 2022
63 changes: 32 additions & 31 deletions docs/localdev.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,55 @@ These values can be adjusted by editing the localdev env file [.env](../localdev

## _*IMPORTANT*_

It's suggested you work in branch `local` when developing
Pushing / merging PR's to any branches with a prefix of `aws/` will trigger deployment actions
Pushing / merging PR's to any branches with a prefix of `aws/` will
trigger deployment actions, when developing locally, create a new branch
and submit a pull request to `aws/trashai-staging`

---
# Set up

## Operating System Requirements

- Linux
- MacOS (testing)
- Windows using WSL2
- WSL Integration on Ubuntu must be enabled in Docker options -> Resources -> WSL Integration
- Repo must be inside Ubuntu (i.e. ~/code/trash-ai)
- Make local must be run from a WSL (Ubuntu) terminal
- Take note of docker-compose installation (installing through apt may not install the correct version)

## Software Requirements
- MacOS
- Windows using [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install)

- docker ce
- ubuntu/debian: https://docs.docker.com/engine/install/ubuntu/
## 1. Install Required Software
- docker desktop (or configure docker engine and docker-compose another way)
- ubuntu/debian: https://docs.docker.com/desktop/install/linux-install/
- mac: https://docs.docker.com/desktop/mac/install/
- docker-compose [Instructions](https://docs.docker.com/compose/install/)
- Docker-compose file version `>3.7` are supported
- For MacOS, use docker-compose version 1.x
```shell
$ docker-compose disable-v2
```

---

## Optional Software

- windows: https://docs.docker.com/desktop/install/windows-install/
- If prompted to do so, download and install the Linux kernel update package. Complete steps 4-6 in the linked article.

### Optional Software
- gnu make
- ubuntu/debian: `apt-get install build-essential`
- ubuntu/debian/wsl2: `apt-get install build-essential`
- mac: `brew install make`

## Running the dev environment

### Using make in project root:
## 2. Install repo
- Windows: Repo must be inside Ubuntu (i.e. ~/code/trash-ai)

```
make local
```shell
cd ~/
mkdir code
cd code
git clone https://github.com/code4sac/trash-ai
```

---

### Using the shell:
## Running the local dev environment

### Option 1. Using make in project root:
- Windows: Make local must be run from a WSL (Ubuntu) terminal
```shell
cd trash-ai
make local
```

---

### Option 2. Using the shell:
```shell
cd localdev
# need to make sure the containers are down before starting
docker-compose down
Expand Down
2 changes: 1 addition & 1 deletion localdev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.18-buster
FROM --platform=linux/amd64 node:14.18-buster

# Set this to whatever your local user id is
ENV USER_ID=1000
Expand Down
3 changes: 2 additions & 1 deletion localdev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ down:
docker-compose down

up: down
docker-compose up --remove-orphans --build
docker-compose build
docker-compose up --remove-orphans
make down
2 changes: 1 addition & 1 deletion localdev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:
- "backend"

environment:
VITE_GOOGLE_MAPS_API_KEY: ${VITE_GOOGLE_MAPS_API_KEY}
VITE_GOOGLE_MAPS_API_KEY: ${VITE_GOOGLE_MAPS_API_KEY-:"NOGOOGLEKEY"}

ports:
- ${VITE_FRONTEND_PORT}:${VITE_FRONTEND_PORT}
Expand Down