Skip to content

Commit

Permalink
feat: edit config files
Browse files Browse the repository at this point in the history
  • Loading branch information
bodyangug committed Sep 14, 2023
1 parent ed9e8b0 commit 732631b
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 9 deletions.
1 change: 1 addition & 0 deletions utils/indigo-service/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=indigo-service
60 changes: 60 additions & 0 deletions utils/indigo-service/MANUALY_DEPLOY_CLOUD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# How to Deploy Indigo-Service in the Cloud

Follow these steps to deploy indigo-service in a cloud environment.

## Prerequisites

1. On the remote machine, update your installed packages.
2. Install Docker (For example, on AWS
Linux: [click](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7))

## Deployment Steps

1. Set up a local environment variable `HOST_IP` on the machine where you want to deploy the service. Use the following
commands based on your OS:

For Windows: `set HOST_IP=<ip address of instance>`

For MacOS/Unix: `export HOST_IP=<ip address of instance>`

2. In the `ui` folder of the frontend part, find the `.env` file and set up the following variables:

```
REACT_APP_API_POSTGRES=http://<ip address of instance>:8080/v2
REACT_APP_API_ELASTIC=http://<ip address of instance>:8080/v3
```

3. Build the `ui` folder using `yarn` by running the following command:

```
yarn build
```

**Note**: Don't forget to remove the old build folder if it exists.

4. Zip the `indigo-service` folder.

5. Upload the zipped file to your instance. You can use
the [scp](https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/) command or apps
like [FileZilla](https://filezilla-project.org/).

6. Unzip the uploaded file on the remote machine by running:

```
unzip indigo-service.zip
```

7. In the root directory of `indigo-service`, use Docker to build images and run them with the following commands:

```
docker-compose build --no-cache
docker-compose up -d
```

8. Check the result in your browser by navigating to:

```
http://<ip-address>:8080
```

Now you have successfully deployed indigo-service in the cloud!
40 changes: 40 additions & 0 deletions utils/indigo-service/MANUALY_DEPLOY_LOCAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# How to Deploy Indigo-Service Locally

Follow these steps to deploy indigo-service on your local machine.

## Deployment Steps

1. Set up a local environment variable `HOST_IP` on your machine. Use the following commands based on your OS:

For Windows: `set HOST_IP=localhost`

For MacOS/Unix: `export HOST_IP=localhost`

2. In the `ui` folder of the frontend part, find the `.env` file and set up the following variables:

```
REACT_APP_API_POSTGRES=http://localhost:8080/v2
REACT_APP_API_ELASTIC=http://localhost:8080/v3
```

3. Build the `ui` folder using `yarn` by running the following command:

```
yarn build
```

**Note**: Don't forget to remove the old build folder if it exists.

4. Open a command prompt or terminal at the root of `indigo-service`, and use Docker to build images and run them with
the following commands:

```
docker-compose build --no-cache
docker-compose up -d
```

Now you have successfully deployed indigo-service on your local machine!

## Useful Links

- [How to install yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)
33 changes: 24 additions & 9 deletions utils/indigo-service/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,44 @@ services:
env_file: ./env/db.env
ports:
- "5432:5432"
volumes:
- db_pgdata:/var/lib/postgresql/data
restart: always

backend:
elastic:
image: elasticsearch:8.8.1
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.license.self_generated.type=trial
- xpack.security.enabled=false
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false

backend-postgres:
build:
context: ./backend/
context: ./backend/postgres/
dockerfile: ./Dockerfile
env_file: ./env/db.env
depends_on:
- db
restart: always
command: supervisord -n

backend-elastic:
build:
context: ./backend/elastic/
dockerfile: ./Dockerfile
depends_on:
- elastic
restart: always
command: supervisord -n

frontend:
build:
context: ./frontend/
dockerfile: ./Dockerfile
env_file: ./frontend/ui/.env
depends_on:
- backend
- backend-postgres
ports:
- "80:80"
- "8080:80"
restart: always

volumes:
db_pgdata:

0 comments on commit 732631b

Please sign in to comment.