Halo Developer Guide

Administrator
发布于 2023-09-02 / 240 阅读
0
0

Halo Developer Guide

Preparation

Environmental requirements

Working directory

Refers to the working directory that Halo depends on. When Halo is running, a halo-next folder will be generated in the current user directory of the system. The absolute path is ~/halo-next. It usually contains the following directories or files:

  1. db: Stores the physical files of H2 Database. If you use other databases, this directory will not exist.

  2. themes: Contains themes installed by users.

  3. plugins: Contains plug-ins installed by users.

  4. attachments: Attachment directory.

  5. logs: Run log directory.

Development environment running

Project structure description

Currently, if you need to run Halo completely, you need a total of three parts:

  1. Halo main project ( halo-dev/halo )

  2. Console console (hosted in Halo main project)

  3. Theme (the default theme is already included in the main Halo project)

Clone project

If you have already forked the relevant warehouse, please replace halo-dev in the following command with your GitHub username.

git clone https://github.com/halo-dev/halo

# Or use ssh to clone (recommended)

git clone [email protected]:halo-dev/halo.git

Run Console

cd path/to/halo

Linux / macOS platform:

make -C console dev

Windows platform:

cd console

pnpm install

pnpm build:packages

pnpm dev

In the end, the console prints the following information, which means it is running normally:

VITE v3.1.6  ready in 638 ms

➜  Local:   http://localhost:3000/console/

HINT

Please do not directly use the running port (3000) of the Console to access, as it will cause failure to log in normally due to cross-domain issues. It is recommended to follow the next steps to run Halo with the dev configuration file. In the dev configuration file, we proxy the Console access by default. address, so subsequent access to the Console http://localhost:8090/consolecan be accessed. Relevant configuration of the agent:

halo:
  console:
    proxy:
      endpoint: http://localhost:3000/
      enabled: true

Run Halo

  1. Open the Halo project in IntelliJ IDEA and wait for Gradle initialization and dependency downloading to complete.

  2. Modify the running configuration of IntelliJ IDEA

    1. macOS/Linux Change Active Profiles to dev, as shown:
      IntelliJ-IDEA-Profiles-macOS-9d5469314ee5d8703a11da404399c1b8.png

    2. Windows changes Active Profiles to dev,win, as shown in the figure:
      IntelliJ-IDEA-Profiles-Win-68071f7bc26ca3f5be42a475597e2e3e.png

  3. Click the Run button of IntelliJ IDEA and wait for the project to start.

  4. Or use Gradle to run

# macOS / Linux
./gradlew bootRun --args="--spring.profiles.active=dev"

# Windows
gradlew.bat bootRun --args="--spring.profiles.active=dev,win"

Finally visit http://localhost:8090/consoleto enter the console. Visit http://localhost:8090to enter the homepage of the site.


评论