Skip to content

Commit

Permalink
feat: optimize mac deployment scripts (openimsdk#1795)
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw authored Jan 21, 2024
1 parent 7155d1a commit e182d5e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
24 changes: 23 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ services:
ipv4_address: ${OPENIM_WEB_NETWORK_ADDRESS:-172.28.0.7}

### TODO: Uncomment, or deploy using openim docker: https://github.com/openimsdk/openim-docker
# Uncomment and configure the following services as needed
### Uncomment and configure the following services as needed

# openim-server:
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-server:${SERVER_IMAGE_VERSION:-main}
Expand Down Expand Up @@ -172,6 +172,23 @@ services:
# server:
# ipv4_address: ${OPENIM_SERVER_NETWORK_ADDRESS:-172.28.0.8}

### TODO: mysql is required to deploy the openim-chat component
# mysql:
# image: mysql:${MYSQL_IMAGE_VERSION:-5.7}
# platform: linux/amd64
# ports:
# - "${MYSQL_PORT:-13306}:3306"
# container_name: mysql
# volumes:
# - "${DATA_DIR:-./}/components/mysql/data:/var/lib/mysql"
# - "/etc/localtime:/etc/localtime"
# environment:
# MYSQL_ROOT_PASSWORD: "${MYSQL_PASSWORD:-openIM123}"
# restart: always
# networks:
# server:
# ipv4_address: ${MYSQL_NETWORK_ADDRESS:-172.28.0.15}

# openim-chat:
# image: ${IMAGE_REGISTRY:-ghcr.io/openimsdk}/openim-chat:${CHAT_IMAGE_VERSION:-main}
# container_name: openim-chat
Expand Down Expand Up @@ -199,6 +216,11 @@ services:
# - "${DATA_DIR:-./}/components/openim-chat/config:/openim/openim-chat/config"
# restart: always
# # user: root:root
# depends_on:
# - mysql
# - kafka
# - redis
# - zookeeper
# logging:
# driver: json-file
# options:
Expand Down
43 changes: 38 additions & 5 deletions docs/contrib/mac-developer-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,58 @@ Homebrew is an essential package manager for macOS. Install it using:

### Forking and Cloning the Repository

1. Fork the OpenIM repository on GitHub to your account.
2. Clone your fork to your local machine:
To optimize and add logic to your instructions, particularly regarding deploying on a Mac, you can modify them as follows:

1. **Fork the OpenIM Repository**: Fork the OpenIM repository on GitHub to your account.

2. **Clone Your Fork to Your Local Machine**:
Open your terminal and execute the following commands:

```sh
# Clone the repository
git clone https://github.com/<your-username>/open-im-server.git
# The Docker bridging network mode for Mac is slightly different and needs to be set:

# Set Docker bridging network mode for Mac
export DOCKER_BRIDGE_SUBNET=127.0.0.0/16

# Set OpenIM IP
export OPENIM_IP=<your-ip>
# Init Config

# Initialize configuration
make init

# Start Components
# Start components using Docker
docker compose up -d

# Start OpenIM Server
make start
```

3. **Additional Steps for Mac Deployment**:
If you are deploying on a Mac and wish to use the chat feature, you need to modify the `docker-compose` file. Specifically, you'll need to uncomment the sections related to `openim-chat` and `mysql`.

Here's how to do it:

- Open the `docker-compose.yml` file in a text editor.
- Find the sections for `openim-chat` and `mysql`.
- Remove the comment marks (`#`) at the beginning of the lines in these sections to enable them.
- Save the file after making these changes.

4. **Update and Restart Services**:
After modifying the `docker-compose` file, you need to update and restart the services to apply these changes. Run the following command in your terminal:

```sh
# Update and restart services
docker compose up -d

# Check openim-chat start
docker compose logs openim-chat
```

This command will re-read the `docker-compose.yml` file, apply the new configuration, and restart the necessary containers.

Remember, replacing `<your-username>` and `<your-ip>` with your actual GitHub username and desired IP address for OpenIM is crucial. These steps should streamline the setup process, particularly for Mac users wishing to use the chat feature.

### Setting Up the Devcontainer

`Devcontainers` provide a Docker-based isolated development environment.
Expand Down

0 comments on commit e182d5e

Please sign in to comment.