Skip to content

Commit

Permalink
feat: added support for MinIO object store, fixed CONTRIBUTING.md and…
Browse files Browse the repository at this point in the history
… setup script (#752)

### Description

- **Issue Fix**: Resolved issue #743 by adding support for Minio object
storage, enabling self-hosting for Impler.
- **Documentation Update**: Revised `CONTRIUTING.md` to reflect the
latest guidelines and processes.
- **Setup Script Fix**: Updated and corrected the setup script to ensure
a correct setup of the web part.

### Details

- Integrated Minio as an alternative object storage solution for those
who prefer or require self-hosting options. Adjusted the configuration
and ensured compatibility with existing workflows.
- Made several improvements to the `CONTRIBUTING.md` file, including
clearer instructions and updated requirements, making it easier for new
contributors to get started.
- Fixed issues in the setup script that were causing errors during
initial setup. This should improve the setup experience and reduce
friction for new developers.

### Testing

- Verified that Minio integrates seamlessly with the existing setup and
that all relevant functionalities are working as expected.
- Tested the revised setup script on multiple environments to ensure
consistent and error-free setup.
- Reviewed the updated `CONTRIBUTING.md` with a new contributor to
ensure clarity and completeness.

Resolves #743
  • Loading branch information
chavda-bhavik authored Aug 17, 2024
2 parents 3791833 + aec818f commit 4aa5f65
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ After cloning your fork, follow these steps to set up the project locally,
4. **Do setup for projects by running:**
```bash
pnpm setup:project
5. **In a terminal, start the dependencies (rabbitmq, mongodb and minio) as Docker containers by running the following command:**
```bash
docker compose -f docker/dependencies.compose.yml up -d
```

### Start the application by running the following commands.
5. **Start backend API:**
```bash
Expand Down
8 changes: 4 additions & 4 deletions apps/api/src/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ RABBITMQ_CONN_URL=amqp://guest:guest@localhost:5672
MONGO_URL=mongodb://localhost:27017/impler-db

# Storage
S3_LOCAL_STACK=http://localhost:4566
S3_LOCAL_STACK=http://localhost:9000
S3_REGION=us-east-1
S3_BUCKET_NAME=impler
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=impler
AWS_SECRET_ACCESS_KEY=implers3cr3t

# Analytics
SENTRY_DSN=
Expand All @@ -26,4 +26,4 @@ WEB_BASE_URL=http://localhost:4200
COOKIE_DOMAIN=
GITHUB_OAUTH_REDIRECT=
GITHUB_OAUTH_CLIENT_ID=
GITHUB_OAUTH_CLIENT_SECRET=
GITHUB_OAUTH_CLIENT_SECRET=
8 changes: 4 additions & 4 deletions apps/api/src/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ RABBITMQ_CONN_URL=amqp://guest:guest@localhost:5672
MONGO_URL=mongodb://localhost:27017/impler-db

# Storage
S3_LOCAL_STACK=http://localhost:4566
S3_LOCAL_STACK=http://localhost:9000
S3_REGION=us-east-1
S3_BUCKET_NAME=impler
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=impler
AWS_SECRET_ACCESS_KEY=implers3cr3t

# Analytics
SENTRY_DSN=
Expand All @@ -26,4 +26,4 @@ WEB_BASE_URL=http://localhost:4200
COOKIE_DOMAIN=
GITHUB_OAUTH_REDIRECT=
GITHUB_OAUTH_CLIENT_ID=
GITHUB_OAUTH_CLIENT_SECRET=
GITHUB_OAUTH_CLIENT_SECRET=
8 changes: 4 additions & 4 deletions apps/api/src/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ RABBITMQ_CONN_URL=amqp://guest:guest@localhost:5672
MONGO_URL=mongodb://localhost:27017/impler-db

# Storage
S3_LOCAL_STACK=http://localhost:4566
S3_LOCAL_STACK=http://localhost:9000
S3_REGION=us-east-1
S3_BUCKET_NAME=impler
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=impler
AWS_SECRET_ACCESS_KEY=implers3cr3t

# Analytics
SENTRY_DSN=
Expand All @@ -26,4 +26,4 @@ WEB_BASE_URL=http://localhost:4200
COOKIE_DOMAIN=
GITHUB_OAUTH_REDIRECT=
GITHUB_OAUTH_CLIENT_ID=
GITHUB_OAUTH_CLIENT_SECRET=
GITHUB_OAUTH_CLIENT_SECRET=
8 changes: 4 additions & 4 deletions apps/api/src/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MONGO_URL=mongodb://localhost:27017/impler-db
SENTRY_DSN=

# Storage
S3_LOCAL_STACK=http://localhost:4566
S3_LOCAL_STACK=http://localhost:9000
S3_REGION=us-east-1
S3_BUCKET_NAME=impler
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=impler
AWS_SECRET_ACCESS_KEY=implers3cr3t

# URLs
WIDGET_BASE_URL=http://localhost:3500
Expand All @@ -33,4 +33,4 @@ SES_REGION=
SES_ACCESS_KEY_ID=
SES_SECRET_ACCESS_KEY=
EMAIL_FROM=
EMAIL_FROM_NAME=
EMAIL_FROM_NAME=
2 changes: 1 addition & 1 deletion apps/web/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ NEXT_PUBLIC_TAWK_PROPERTY_ID=
NEXT_PUBLIC_TAWK_WIDGET_ID=
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_DSN=
NODE_ENV=production
NODE_ENV=
6 changes: 3 additions & 3 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ MONGO_URL=mongodb://mongodb:27017/impler
RABBITMQ_CONN_URL=amqp://guest:guest@rabbitmq:5672

# AWS
S3_LOCAL_STACK=http://localhost:4566
S3_LOCAL_STACK=http://localhost:9000
S3_BUCKET_NAME=impler
S3_REGION=us-east-1
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_ACCESS_KEY_ID=impler
AWS_SECRET_ACCESS_KEY=implers3cr3t

# Ports
API_PORT=3000
Expand Down
60 changes: 60 additions & 0 deletions docker/dependencies.compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: '3'
services:

mongodb:
image: mongo
container_name: mongodb
ports:
- 27017:27017
restart: unless-stopped
networks:
- impler

rabbitmq:
image: rabbitmq:3-alpine
container_name: rabbitmq
restart: always
ports:
- 5672:5672
- 5671:5671
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "5672"]
interval: 5s
timeout: 15s
retries: 1
networks:
- impler

minio:
image: minio/minio
volumes:
- minio_data:/data
environment:
MINIO_ROOT_USER: impler
MINIO_ROOT_PASSWORD: implers3cr3t
ports:
- 9000:9000
- 9001:9001
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3

createbuckets:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set myminio http://minio:9000 impler implers3cr3t;
/usr/bin/mc mb myminio/impler;
exit 0;
"
volumes:
minio_data:

networks:
impler:
38 changes: 37 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3"
services:

mongodb:
image: mongo
container_name: mongodb
Expand All @@ -15,6 +16,7 @@ services:
restart: unless-stopped
networks:
- impler

api:
privileged: true
image: "ghcr.io/implerhq/impler/api:0.24.0"
Expand Down Expand Up @@ -49,6 +51,7 @@ services:
- "3000:3000"
networks:
- impler

queue-manager:
image: "ghcr.io/implerhq/impler/queue-manager:0.24.0"
depends_on:
Expand All @@ -73,6 +76,7 @@ services:
ALERT_EMAIL_FROM: ${ALERT_EMAIL_FROM}
networks:
- impler

widget:
image: "ghcr.io/implerhq/impler/widget:0.24.0"
depends_on:
Expand All @@ -87,6 +91,7 @@ services:
- 3500:3500
networks:
- impler

embed:
depends_on:
- widget
Expand All @@ -98,6 +103,7 @@ services:
- 4701:4701
networks:
- impler

web:
depends_on:
- api
Expand Down Expand Up @@ -126,7 +132,37 @@ services:
retries: 1
networks:
- impler

minio:
image: minio/minio
volumes:
- minio_data:/data
environment:
MINIO_ROOT_USER: impler
MINIO_ROOT_PASSWORD: implers3cr3t
ports:
- 9000:9000
- 9001:9001
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3

createbuckets:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set myminio http://minio:9000 impler implers3cr3t;
/usr/bin/mc mb myminio/impler;
exit 0;
"
volumes:
mongodb: ~

networks:
impler:
impler:
2 changes: 1 addition & 1 deletion scripts/setup-env-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fs = require('fs');

(async () => {
const appsEnvInSrc = ['api', 'queue-manager'];
const appsEnvInRoot = ['widget'];
const appsEnvInRoot = ['widget', 'web'];

console.log('----------------------------------------');
console.log('Pre-populating .env files from .example.env');
Expand Down

0 comments on commit 4aa5f65

Please sign in to comment.