DOGAI

DOGAI

分享高质量GitHub开源项目,低价高质量服务器请看:https://www.vps567.com 香港CN2服务器 高防美国和大陆服务器 还有全球CDN加速。

PaoPao-CE: A high-fidelity Weibo, a highly popular open-source community system on GitHub

PaoPao is a refreshing and artistic micro-community, similar to Weibo and Twitter, but with a greater emphasis on artistic and creative expression. It is built on technologies such as Go, Gin, Zinc, Vue, and TypeScript, offering good performance and scalability. This article will introduce the features, tech stack, quick start guide, and deployment methods of PaoPao, helping you quickly set up your own micro-community.

68747470733a2f2f63646e2e726f63732e6d652f7374617469632f70616f70616f2d6c696768742e6a706567

Core Features#

  • Publish Updates: Users can publish updates in the form of text, images, videos, etc., sharing their thoughts and creativity.
  • Comment Interaction: Users can comment on other users' updates for interactive communication.
  • Search Function: Users can search for relevant updates and users through keywords.
  • Personal Homepage: Users can set up personal profiles, avatars, backgrounds, etc., to showcase their individuality.
  • Theme Switching: Users can choose different theme styles, such as light and dark.
  • Desktop Application: PaoPao also provides a desktop application for users to use on their computers.

Technical Highlights#

The tech stack of PaoPao-CE showcases its modern and high-performance characteristics. Here are the main technologies and tools used to build this project:

Backend Technologies#

  • Go: A statically typed, compiled, concurrent programming language with garbage collection features.
  • Gin: A web framework written in Go, known for its high performance.
  • Zinc: An open-source search engine based on Elasticsearch, providing search capabilities for PaoPao-CE.
  • Buf: A tool for managing Protocol Buffers files.
  • gRPC: A high-performance, open-source, and universal RPC framework.
  • Meilisearch: A fast and easy-to-use open-source search engine.

Frontend Technologies#

  • Naive UI: A component library for Vue 3, providing a range of aesthetically pleasing components.
  • Vue.js: A progressive JavaScript framework for building user interfaces.
  • Vite.js: A modern frontend build tool.
  • Tauri: A framework for building lightweight, secure, cross-platform desktop applications.

Installation Guide#

Environment Requirements#

  • Go (1.20+)
  • Node.js (14+)
  • MySQL (5.7+)
  • Redis
  • Meilisearch

The above environment versions are the official development versions for PaoPao and are for reference only; other versions have not been thoroughly tested.

Installation Instructions#

Before starting the installation, we need a server. I recommend Wu Liu Qi Cloud for the server: https://www.vps567.com Hong Kong 2H2G5M server for $20/month, and high-defense CDN acceleration starts at just $18/month.

Clone the repository

git clone https://github.com/rocboss/paopao-ce.git

Backend#

  1. Import the scripts/paopao.sql file from the project root directory into the MySQL database.

  2. Copy the config.yaml.sample file from the project root directory to config.yaml and complete the configuration editing according to the comments.

  3. Compile the backend
    Compile the API service:

    make build
    

    Compile the API service with embedded web frontend UI:

    make build
    

    You can also compile in slim mode without embedding the web frontend UI:

    make build TAGS='slim embed'
    

    After compilation, the corresponding executable file can be found in the release directory.

    release/paopao
    
  4. Run the backend directly
    Run the API service:

    make run
    

    Run the API service and web frontend UI service:

    make run TAGS='embed'
    

    Note: If you need to embed the web frontend UI, please build the web frontend first (it is recommended to set web/.env to VITE_HOST="").

  5. Use the built-in Migrate mechanism to automatically upgrade and maintain SQL DDL:

    # Add Migration feature to Features to enable migrate functionality
    vim config.yaml
    # file: config.yaml
    # Features:
    #   Default: ["Base", "MySQL", "Zinc", "MinIO", "LoggerZinc", "Migration"]
    
    # Compile with migration tag to produce an executable file that supports migrate functionality
    make build TAGS='migration'
    release/paopao
    
    # Or run directly with migration tag
    make run TAGS='migration'
    

    Note: The default compiled executable file does not have the migrate functionality built-in; you need to compile with the migration tag to include support for the migrate feature.

Frontend#

  1. Enter the frontend directory web, copy .env to .env.local, edit the backend service address and other configuration items in the .env.local file, and download the dependencies.

    cd ./web && cp .env .env.local
    vim .env.local
    yarn
    
  2. Compile the frontend

    yarn build
    

    After the build is complete, you can find the compiled output in the dist directory, and configure nginx to point to that directory.

Desktop#

  1. Enter the frontend directory web, copy .env to .env.local, edit the backend service address and other configuration items in the .env.local file, and download the dependencies.

    cd ./web && cp .env .env.local
    vim .env.local
    yarn
    
  2. Compile the frontend

    yarn build
    
  3. Build the desktop application

    yarn tauri build
    

    The desktop application is written using Rust + tauri and requires the installation of Tauri dependencies. For specifics, refer to https://tauri.studio/v1/guides/getting-started/prerequisites.

Method 2: Build and Run with Docker#

  • Backend:
# Build with default parameters, embedding web UI and setting API host to empty
docker build -t your/paopao-ce:tag .

# Embed web UI and customize API host parameter
docker build -t your/paopao-ce:tag --build-arg API_HOST=http://api.paopao.info .

# Embed web UI and use API host from local web/.env
docker build -t your/paopao-ce:tag --build-arg USE_API_HOST=no .

# Embed web UI and use locally compiled web/dist
docker build -t your/paopao-ce:tag --build-arg USE_DIST=yes .

# Only compile API server
docker build -t your/paopao-ce:tag --build-arg EMBED_UI=no .

# Run
mkdir custom && docker run -d -p 8008:8008 -v ${PWD}/custom:/app/paopao-ce/custom -v ${PWD}/config.yaml.sample:/app/paopao-ce/config.yaml your/paopao-ce:tag

# Or run the built docker image directly
mkdir custom && docker run -d -p 8008:8008 -v ${PWD}/custom:/app/paopao-ce/custom -v ${PWD}/config.yaml.sample:/app/paopao-ce/config.yaml bitbus/paopao-ce:latest
  • Frontend:
cd web

# Build with default parameters
docker build -t your/paopao-ce:web .

# Build with custom API host parameter
docker build -t your/paopao-ce:web --build-arg API_HOST=http://api.paopao.info .

# Build using locally compiled dist
docker build -t your/paopao-ce:web --build-arg USE_DIST=yes .

# Run
docker run -d -p 8010:80 your/paopao-ce:web
  • All-In-One:
# Build Image
docker buildx build --build-arg USE_DIST="yes" -t your/paopao-ce:all-in-one-latest -f Dockerfile.allinone .

# Run
docker run --name paopao-ce-allinone  -d -p 8000:8008 -p 7700:7700 -v ./data/custom:/app/custom -v ./data/meili_data:/app/meili_data your/paopao-ce:all-in-one-latest

# Or run using the official image
docker run --name paopao-ce-allinone  -d -p 8000:8008 -p 7700:7700 -v ./data/custom:/app/custom -v ./data/meili_data:/app/meili_data bitbus/paopao-ce:all-in-one-latest

# Or run using the official image + custom config.yaml
docker run --name paopao-ce-allinone  -d -p 8000:8008 -p 7700:7700 -v ./config.yaml:/app/config.yaml -v ./data/custom:/app/custom -v ./data/meili_data:/app/meili_data bitbus/paopao-ce:all-in-one-latest

Note that the value of Meili.ApiKey in config.yaml must match the value of the MEILI_MASTER_KEY environment variable set when starting Meili in the container, which defaults to paopao-meilisearch. This value can be set when starting the container using -e MEILI_MASTER_KEY=<custom-key>.

Method 3: Run using docker-compose#

git clone https://github.com/rocboss/paopao-ce.git
cd paopao-ce && docker compose up -d
# visit http://localhost:8008  👀 paopao-ce
# visit http://localhost:8001  👀 RedisInsight
# visit http://localhost:8080  👀 phpMyAdmin

By default, the configuration uses config.yaml.sample. If you need to customize the configuration, please copy the default configuration file (e.g., config.yaml), modify it, and then synchronize the configuration to docker-compose.yaml as follows:

# file: docker-compose.yaml
...
  backend:
    image: bitbus/paopao-ce:latest
    restart: always
    depends_on:
      - db
      - redis
      - zinc
    # modify below to reflect your custom configure
    volumes:
      - ./config.yaml:/app/paopao-ce/config.yaml
    ports:
      - 8008:8008
    networks:
      - paopao-network
....

Note: The default provided docker-compose.yaml is intended for setting up a local development and debugging environment. If you need to deploy for external access, please adjust the configuration parameters or use other deployment methods.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.