`Devcontainers` provide a Docker-based isolated development environment.
Read [README.md](https://github.com/openimsdk/open-im-server/tree/main/.devcontainer) in the `.devcontainer` directory of the project to learn more about the devcontainer.
To optimize and add logic to your instructions, particularly regarding deploying on a Mac, you can modify them as follows:
To set it up:
1. Install Docker Desktop for Mac from [Docker Hub](https://docs.docker.com/desktop/install/mac-install/).
2. Install Visual Studio Code and the Remote - Containers extension.
3. Open the cloned OpenIM repository in VS Code.
4. VS Code will prompt to reopen the project in a container. Accept this to set up the environment automatically.
1. **Fork the OpenIM Repository**: Fork the OpenIM repository on GitHub to your account.
### Installing Go and Dependencies
2. **Clone Your Fork to Your Local Machine**:
Open your terminal and execute the following commands:
Ensure the version of Go is compatible with the version required by OpenIM (refer to the main documentation for version requirements).
# Set OpenIM IP
export OPENIM_IP=<your-ip>
### Additional Tools
# Initialize configuration
make init
Install other required tools like Docker, Vagrant, and necessary GNU utils as described in the main documentation.
# Start components using Docker
docker compose up -d
## Mac Deployment openim-chat and openim-server
# Start OpenIM Server
make start
To integrate the Chinese document into an English document for Linux deployment, we will first translate the content and then adapt it to suit the Linux environment. Here's how the translated and adapted content might look:
### Ensure a Clean Environment
- It's recommended to execute in a new directory.
- Run `ps -ef | grep openim` to ensure no OpenIM processes are running.
- Run `ps -ef | grep chat` to check for absence of chat-related processes.
- Execute `docker ps` to verify there are no related containers running.
### Source Code Deployment
#### Deploying openim-server
Source code deployment is slightly more complex because Docker's networking on Linux differs from Mac.
export OPENIM_IP="Your IP" # If it's a cloud server, setting might not be needed
make init # Generates configuration files
```
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`.
Before deploying openim-server, modify the Kafka logic in the docker-compose.yml file. Replace:
- 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.
With:
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:
Before starting the openim-server source, set `config/config.yaml` by replacing all instances of `172.28.0.1` with `127.0.0.1`:
# Check openim-chat start
docker compose logs openim-chat
```bash
vim config/config.yaml -c "%s/172\.28\.0\.1/127.0.0.1/g" -c "wq"
```
This command will re-read the `docker-compose.yml` file, apply the new configuration, and restart the necessary containers.
Then start openim-server:
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.
```bash
make start
```
### Setting Up the Devcontainer
To check the startup:
`Devcontainers` provide a Docker-based isolated development environment.
```bash
make check
```
Read [README.md](https://github.com/openimsdk/open-im-server/tree/main/.devcontainer) in the `.devcontainer` directory of the project to learn more about the devcontainer.
<aside>
🚧 To avoid mishaps, it's best to wait five minutes before running `make check` again.
To set it up:
</aside>
1. Install Docker Desktop for Mac from [Docker Hub](https://docs.docker.com/desktop/install/mac-install/).
2. Install Visual Studio Code and the Remote - Containers extension.
3. Open the cloned OpenIM repository in VS Code.
4. VS Code will prompt to reopen the project in a container. Accept this to set up the environment automatically.
#### Deploying openim-chat
### Installing Go and Dependencies
There are several ways to deploy openim-chat, either by source code or using Docker.
Use Homebrew to install Go:
Navigate back to the parent directory:
```sh
brew install go
```bash
cd ..
```
Ensure the version of Go is compatible with the version required by OpenIM (refer to the main documentation for version requirements).
First, let's look at deploying chat from source:
### Additional Tools
```bash
git clone https://github.com/openimsdk/chat
cd chat
make init # Generates configuration files
```
Install other required tools like Docker, Vagrant, and necessary GNU utils as described in the main documentation.
If openim-chat has not deployed MySQL, you will need to deploy it. Note that the official Docker Hub for MySQL does not support architectures like ARM, so you can use the newer version of the open-source edition: