Skip to content

Commit

Permalink
feat: add logic to deploy images (#497)
Browse files Browse the repository at this point in the history
* feat: add logic to deploy images

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: add logic to deploy images

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: add ubuntu

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: sync quest

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: add copyright information

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: add more cicd design

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: fix sync

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test file

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test file

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: build multiarch

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: build multiarch

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: add start scripts

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

---------

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>
  • Loading branch information
cubxxw authored Jul 12, 2023
1 parent 531c8a9 commit dd7e2be
Show file tree
Hide file tree
Showing 30 changed files with 323 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golangci-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ name: OpenKF golangci-lint
on:
push:
branches: [main]
pull_request:
branches: [main]
# pull_request:
# branches: [main]
jobs:
golangci:
name: lint
Expand Down
148 changes: 114 additions & 34 deletions .github/workflows/openim-ci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
# Copyright © 2023 OpenIM open source community. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: OpenIM CI

on:
# main branch
on:
push:
branches:
- main
- main
paths-ignore:
- "docs/**"
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
pull_request:
branches:
- main
- main
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
- "docs/**"

jobs:
env:
GO_VERSION: "1.19"
GOLANGCI_VERSION: "v1.50.1"

openimci:
jobs:
openim:
name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment:
name: openimci
name: openim

strategy:
matrix:
go_version: ['1.18', '1.19', '1.20']
os: [ubuntu-latest, macOS-latest]
go_version: ["1.18","1.19","1.20"]
os: [ubuntu-latest]

steps:
- name: Set up Go ${{ matrix.go_version }}
Expand All @@ -32,41 +58,95 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Run go modules Tidy
- name: Run go modules tidy
run: |
make tidy
- name: Generate all necessary files, such as error code files
- name: Run go format
run: |
make gen
make format
echo "Run go format successfully"
- name: Check syntax and styling of go sources
run: |
make lint
# - name: Generate all necessary files, such as error code files
# run: |
# make generate

- name: Run unit test and get test coverage
run: |
make cover
# - name: Check syntax and styling of go sources
# run: |
# set -e
# make lint

# - name: Run unit test and get test coverage
# run: |
# make cover

- name: Build source code for host platform
run: |
make build
make multiarch
echo "Build source code for host platform successfully"
- name: Collect Test Coverage File
uses: actions/[email protected]
with:
name: main-output
path: _output/coverage.out
# - name: Collect Test Coverage File
# uses: actions/[email protected]
# with:
# name: main-output
# path: _output/tmp/coverage.out

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# lint:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}

# - name: golangci-lint
# uses: golangci/golangci-lint-action@v3
# with:
# version: ${{ env.GOLANGCI_VERSION }}

- name: Build docker images for host arch and push images to registry
run: |
make push
# docker-image-tests:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}

# - name: Run tests
# run: make build

# - name: Test docker image
# run: |
# docker build -t openim:ci-build .

# goreleaser-test:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}

# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v4
# with:
# version: latest
# args: release --clean --skip-publish --snapshot
50 changes: 50 additions & 0 deletions .github/workflows/scripts-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Execute Scripts

on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
pull_request:
branches:
- main
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
- "docs/**"

jobs:
execute-scripts:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Start Docker Compose
run: docker-compose up -d

- name: Stop all services
run: |
chmod +x ./scripts/stop_all.sh
./scripts/stop_all.sh
- name: Build all services
run: |
chmod +x ./scripts/build_all_service.sh
./scripts/build_all_service.sh
- name: Start all services
run: |
chmod +x ./scripts/start_all.sh
./scripts/start_all.sh
- name: Check all services
run: |
chmod +x ./scripts/check_all.sh
./scripts/check_all.sh
4 changes: 0 additions & 4 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
Expand All @@ -25,7 +22,6 @@ jobs:
with:
GH_INSTALLATION_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}"
CONFIG_PATH: .github/sync.yml
GH_PAT: "${{ secrets.BOT_GITHUB_TOKEN }}"
ORIGINAL_MESSAGE: true
SKIP_PR: true
COMMIT_EACH_FILE: false
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<h1 align="center" style="border-bottom: none">
<b>
<a href="https://doc.rentsoft.cn/">Open IM Server</a><br>
</b>
⭐️ Open source Instant Messaging Server ⭐️ <br>
</h1>
<p align="center">
<a href="https://www.openim.online">
<img src="./assets/logo-gif/openim-logo.gif" width="60%" height="30%"/>
</a>
</p>
<h3 align="center" style="border-bottom: none">
⭐️ Open source Instant Messaging Server ⭐️ <br>
<h3>


<p align=center>
Expand Down
32 changes: 32 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# `/assets`

The `/assets` directory in the OpenIM repository contains various assets such as images, logos, and animated GIFs. These assets serve different purposes and contribute to the functionality and aesthetics of the OpenIM project.

## Directory Structure:

```bash
assets/
├── README.md # Documentation for the assets directory
├── images # Directory holding images related to OpenIM
│ ├── architecture.png # Image depicting the architecture of OpenIM
│ └── mvc.png # Image illustrating the Model-View-Controller (MVC) pattern
├── intive-slack.png # Image displaying the Intive Slack logo
├── logo # Directory containing various logo variations for OpenIM
│ ├── openim-logo-black.png # OpenIM logo with a black background
│ ├── openim-logo-blue.png # OpenIM logo with a blue background
│ ├── openim-logo-green.png # OpenIM logo with a green background
│ ├── openim-logo-purple.png # OpenIM logo with a purple background
│ ├── openim-logo-white.png # OpenIM logo with a white background
│ ├── openim-logo-yellow.png # OpenIM logo with a yellow background
│ └── openim-logo.png # OpenIM logo with a transparent background
└── logo-gif # Directory containing animated GIF versions of the OpenIM logo
└── openim-log.gif # Animated OpenIM logo with a transparent background
```

## Copyright Notice:

The OpenIM logo, including its variations and animated versions, displayed in this repository [OpenIM](https://github.com/OpenIMSDK/openim) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.

The logo design is credited to @Xx(席欣).

Please respect the intellectual property rights and refrain from unauthorized use and distribution of these assets.
Binary file added assets/intive-slack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/logo-gif/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The OpenIM logo files are licensed under a choice of either Apache-2.0 or CC-BY-4.0 (Creative Commons Attribution 4.0 International).
Binary file added assets/logo-gif/openim-logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/logo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The OpenIM logo files are licensed under a choice of either Apache-2.0 or CC-BY-4.0 (Creative Commons Attribution 4.0 International).
Binary file added assets/logo/openim-logo-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-cyan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-gradient.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-purple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo-yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openim-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ require (
github.com/go-sql-driver/mysql v1.6.0
github.com/go-zookeeper/zk v1.0.3
github.com/redis/go-redis/v9 v9.0.5
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
)

require (
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
36 changes: 24 additions & 12 deletions install_im_server.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
#!/usr/bin/env bash
internet_ip=`curl ifconfig.me -s`

# Get the public internet IP address
internet_ip=$(curl ifconfig.me -s)
echo $internet_ip

# Load environment variables from .env file
source .env
echo $MINIO_ENDPOINT
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
sed -i "s/127.0.0.1/${internet_ip}/" .env

# Replace local IP address with the public IP address in .env file
if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then
sed -i "s/127.0.0.1/${internet_ip}/" .env
fi

cd scripts ;
chmod +x *.sh ;

# Change directory to scripts folder
cd scripts
chmod +x *.sh

# Execute necessary scripts
./init_pwd.sh
./env_check.sh;
cd .. ;
./env_check.sh

# Go back to the previous directory
cd ..

# Check if docker-compose command is available
if command -v docker-compose &> /dev/null
then
docker-compose up -d ;
docker-compose up -d
else
docker compose up -d ;
docker compose up -d
fi

# Change directory to scripts folder again
cd scripts

cd scripts ;
./docker_check_service.sh
# Check docker services
./docker_check_service.sh
Loading

0 comments on commit dd7e2be

Please sign in to comment.