Skip to content

Commit dc9aee1

Browse files
Merge pull request #7 from pymc-labs/development
Adds development server
2 parents bfcbeac + 7b19c6b commit dc9aee1

15 files changed

+465
-194
lines changed

Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ENV APP_HOME=/app
44
ENV PORT=5000
55
ENV JAX_PLATFORM_NAME=cpu
66

7+
ARG API_KEY
8+
ENV API_KEY=$API_KEY
9+
710
WORKDIR $APP_HOME
811

912
COPY . ./
@@ -14,7 +17,8 @@ RUN micromamba install -y -n base -f /tmp/env.yaml && \
1417
mkdir -p /opt/conda/var/db && \
1518
chown $MAMBA_USER:$MAMBA_USER /opt/conda/var/db && \
1619
mkdir -p /opt/conda/var/db/redis && \
17-
chown $MAMBA_USER:$MAMBA_USER /opt/conda/var/db/redis
20+
chown -R $MAMBA_USER:$MAMBA_USER /opt/conda/var/db/redis && \
21+
chmod -R 770 /opt/conda/var/db/redis
1822

1923
# Copy the start script
2024
COPY --chown=$MAMBA_USER:$MAMBA_USER start.sh $APP_HOME/start.sh

README.md

+52-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ A cloud-based Marketing Mix Modeling (MMM) solution deployed on Google Cloud Pla
44

55
## Quick Deployment
66
```bash
7-
./deploy.sh # Deploy the latest version to production
7+
./deploy.sh production # Deploy the latest version to production
8+
./deploy.sh development # Deploy the latest version to development
89
```
910

1011
## System Architecture
@@ -18,6 +19,7 @@ GPT-Bayes consists of two main components:
1819

1920
2. **Backend Service**
2021
- Production URL: https://nextgen-mmm.pymc-labs.com
22+
- Development URL: https://dev-nextgen-mmm.pymc-labs.com
2123
- Function: Handles model fitting and parameter management via API endpoints
2224
- Infrastructure: Hosted on Google Cloud Engine (GCE) under the `gpt-bayes` project
2325

@@ -31,8 +33,10 @@ GPT-Bayes consists of two main components:
3133
- `nginx/` - NGINX reverse proxy settings
3234
- `dockerfile` - Container specifications
3335
- `start.sh` - Container initialization
36+
- `build.sh` - Build the container image
3437
- `deploy.sh` - Deployment automation
3538
- `environment.yml` - Development environment specifications
39+
- `config.yaml` - Environment configuration settings
3640

3741
### AI Agent Settings
3842
- `gpt-agent/gpt_prompt.md` - System instructions
@@ -45,23 +49,33 @@ GPT-Bayes consists of two main components:
4549

4650
## Deployment Guide
4751

48-
The application runs on Google Compute Engine (GCE) under the `gpt-bayes` project, accessible at `https://nextgen-mmm.pymc-labs.com`.
52+
The application runs on Google Compute Engine (GCE) under the `gpt-bayes` project, accessible at `https://nextgen-mmm.pymc-labs.com` (production) and `https://dev-nextgen-mmm.pymc-labs.com` (development).
53+
54+
### Build and Push Docker Image
55+
56+
Build and push the Docker image to Google Artifact Registry (GAR).
57+
```bash
58+
./build.sh production # Build and publish to production
59+
./build.sh development # Build and publish to development
60+
```
4961

5062
### Standard Deployment
5163

52-
Use `deploy.sh` to update the application. This script handles:
64+
Once the Docker image is built and pushed to GAR, use `deploy.sh` to update the application. This script handles:
5365
- Updating the container in Google Artifact Registry (GAR)
54-
- Deploying to the production environment
66+
- Deploying to the specified environment
5567

5668
```bash
57-
./deploy.sh
69+
./deploy.sh production # Deploy the latest version to production
70+
./deploy.sh development # Deploy the latest version to development
5871
```
5972

6073
### Server Management
6174

62-
Access the production server:
75+
Access the specified server:
6376
```bash
6477
gcloud compute ssh gpt-bayes --zone us-central1-a
78+
gcloud compute ssh dev-gpt-bayes --zone us-central1-a
6579
```
6680

6781
Container management commands:
@@ -81,10 +95,11 @@ docker exec -it CONTAINER_ID /bin/bash
8195

8296
Build and publish to Google Artifact Registry:
8397
```bash
84-
gcloud builds submit
98+
./build.sh production # Build and publish to production
99+
./build.sh development # Build and publish to development
85100
```
86101

87-
Note: This updates the container image but doesn't affect the production deployment.
102+
Note: This updates the container image but doesn't affect the specified deployment.
88103

89104
### Server Instance Management
90105

@@ -93,42 +108,57 @@ View available Container-Optimized OS images:
93108
gcloud compute images list --project cos-cloud --no-standard-images
94109
```
95110

96-
Update production container:
111+
Update specified container:
97112
```bash
98113
# Clear existing containers
99114
gcloud compute ssh gpt-bayes --zone us-central1-a --command 'docker system prune -f -a'
115+
gcloud compute ssh dev-gpt-bayes --zone us-central1-a --command 'docker system prune -f -a'
100116

101117
# Deploy new container
102118
gcloud compute instances update-container gpt-bayes \
103119
--zone=us-central1-a \
104120
--container-image=us-central1-docker.pkg.dev/bayes-gpt/gpt-bayes/gpt-bayes:latest
121+
122+
gcloud compute instances update-container dev-gpt-bayes \
123+
--zone=us-central1-a \
124+
--container-image=us-central1-docker.pkg.dev/bayes-gpt/dev-gpt-bayes/dev-gpt-bayes:latest
105125
```
106126

107127
Create new server instance:
108128
```bash
109-
gcloud compute instances create gpt-bayes \
110-
--machine-type e2-standard-4 \
111-
--boot-disk-size 20GB \
112-
--image image-name \
113-
--image-project cos-cloud \
114-
--zone us-central1 \
115-
--metadata container-image=your-container-image-name \
116-
--tags http-server \
117-
--firewall-create allow-http
129+
gcloud compute instances create-with-container gpt-bayes \
130+
--machine-type e2-standard-4 \
131+
--boot-disk-size 20GB \
132+
--image cos-stable-117-18613-164-4 \
133+
--image-project cos-cloud \
134+
--zone us-central1-a \
135+
--container-image=us-central1-docker.pkg.dev/bayes-gpt/gpt-bayes/gpt-bayes:latest \
136+
--tags http-server,https-server,allow-tcp-5000
137+
138+
gcloud compute instances create-with-container dev-gpt-bayes \
139+
--machine-type e2-standard-4 \
140+
--boot-disk-size 20GB \
141+
--image cos-stable-117-18613-164-4 \
142+
--image-project cos-cloud \
143+
--zone us-central1-a \
144+
--container-image=us-central1-docker.pkg.dev/bayes-gpt/dev-gpt-bayes/dev-gpt-bayes:latest \
145+
--tags http-server,https-server,allow-tcp-5000
146+
118147
```
119148

120149
### NGINX Configuration (Advanced)
121150

122151
Deploy NGINX reverse proxy updates:
123152
```bash
124153
cd nginx
125-
gcloud builds submit
154+
./deploy.sh production # Deploy the latest version to production
155+
./deploy.sh development # Deploy the latest version to development
126156
```
127157

128158
Update backend IP address:
129-
1. Navigate to `nginx/nginx.conf`
130-
2. Modify the `proxy_pass` directive with the new IP
131-
3. Example: `proxy_pass http://35.208.203.115:5000;`
159+
1. Navigate to `config.yaml`
160+
2. Modify the `ipAddress` directive with the new IP
161+
3. Example: `ipAddress: 35.208.203.115`
132162

133163
## Local Development
134164

0 commit comments

Comments
 (0)