mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 18:29:17 +00:00
Update Set up development environment in README.md. (#995)
This commit is contained in:
106
README.md
106
README.md
@@ -171,43 +171,93 @@ Remember, every contribution counts. Let's make this project better together!
|
||||
|
||||
## Set up development environment
|
||||
|
||||
### Local setup
|
||||
### Developing dependencies
|
||||
|
||||
1. Install a local mysql server, and make a new database
|
||||
2. Rename `/api/example.env` to `.env` and update the `MYSQL_URL` field
|
||||
3. Rename `/ui/example.env` to `.env`
|
||||
- API
|
||||
- Required packages:
|
||||
- `golang` >= 1.22
|
||||
- `g++`
|
||||
- `libc-dev`
|
||||
- `libheif` >= 1.15.1
|
||||
- [go-face Requirements](https://github.com/Kagami/go-face#requirements)
|
||||
- `dlib`
|
||||
- `libjpeg`
|
||||
- `libblas`
|
||||
- `libcblas`, recommended using `libatlas-base`
|
||||
- `liblapack`
|
||||
- Optional tools during developing:
|
||||
- [`reflex`](https://github.com/cespare/reflex): a source code monitoring tool, which automatically rebuilds and restarts the server, running from the code in development.
|
||||
- `sqlite`: the SQLite DBMS, useful to interact with Photoview's SQLite DB directly if you use it in your development environment.
|
||||
- UI
|
||||
- Required packages:
|
||||
- `node` = 18
|
||||
|
||||
### Start API server
|
||||
|
||||
Make sure [golang](https://golang.org/) is installed.
|
||||
|
||||
Some C libraries are needed to compile the API, see [go-face requirements](https://github.com/Kagami/go-face#requirements) for more details.
|
||||
They can be installed as shown below:
|
||||
In Debian/Ubuntu, install dependencies:
|
||||
|
||||
```sh
|
||||
# Ubuntu
|
||||
sudo add-apt-repository ppa:strukturag/libheif
|
||||
sudo add-apt-repository ppa:strukturag/libde265
|
||||
sudo apt-get update
|
||||
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev libheif-dev
|
||||
# Debian
|
||||
sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg62-turbo-dev libheif-dev
|
||||
# macOS
|
||||
brew install dlib libheif
|
||||
|
||||
$ sudo apt update # Update the package list
|
||||
$ sudo apt install golang g++ libc-dev libheif-dev libdlib-dev libjpeg-dev libblas-dev libatlas-base-dev liblapack-dev # For API requirement
|
||||
$ sudo apt install reflex sqlite3 # For API optional tools
|
||||
```
|
||||
|
||||
In macOS, install dependencies:
|
||||
|
||||
```sh
|
||||
$ brew update # Update the package list
|
||||
$ brew install golang gcc libheif dlib jpeg # For API
|
||||
$ brew install reflex sqlite3 # For API optional tools
|
||||
```
|
||||
|
||||
Please follow the package manager guidance if you don't use `apt` or `homebrew`.
|
||||
|
||||
For `node`, recommend to use [nvm](https://github.com/nvm-sh/nvm). Follow [Installing and Updating](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating) to install `nvm` locally, then:
|
||||
|
||||
```sh
|
||||
$ nvm install 18
|
||||
$ nvm use 18
|
||||
```
|
||||
|
||||
You can install `node` with other package manager if you like.
|
||||
|
||||
### Local setup
|
||||
|
||||
1. Rename `/api/example.env` to `.env`
|
||||
- Update `PHOTOVIEW_SQLITE_PATH` if you don't want to put sqlite file under `/api`
|
||||
- To set a different DBMS driver
|
||||
- Comment the SQLite path variable
|
||||
- Update `PHOTOVIEW_DATABASE_DRIVER` with your driver
|
||||
- Uncomment the corresponding connection string variable for the new driver
|
||||
- Optional: modify other variables if needed according to the inline comments
|
||||
2. Rename `/ui/example.env` to `.env`
|
||||
|
||||
### Start API server
|
||||
|
||||
Then run the following commands:
|
||||
|
||||
```bash
|
||||
cd ./api
|
||||
go install
|
||||
go run server.go
|
||||
# Optional: Set the compiler environment in Debian/Ubuntu
|
||||
$ source ./scripts/set_compiler_env.sh
|
||||
# Set the compiler environment with `homebrew`
|
||||
$ export CPLUS_INCLUDE_PATH="$(brew --prefix)/opt/jpeg/include:$(brew --prefix)/opt/dlib/include"
|
||||
$ export LD_LIBRARY_PATH="$(brew --prefix)/opt/jpeg/lib:$(brew --prefix)/opt/dlib/lib"
|
||||
$ export LIBRARY_PATH="$(brew --prefix)/opt/jpeg/lib:$(brew --prefix)/opt/dlib/lib"
|
||||
# Start API server
|
||||
$ cd ./api
|
||||
$ go run .
|
||||
```
|
||||
|
||||
If you want to recompile the server automatically when code changes:
|
||||
|
||||
```sh
|
||||
# Start API server
|
||||
$ cd ./api
|
||||
$ reflex -g '*.go' -s -- go run .
|
||||
```
|
||||
|
||||
The graphql playground can now be accessed at [localhost:4001](http://localhost:4001).
|
||||
|
||||
### Start UI server
|
||||
|
||||
Make sure [node](https://nodejs.org/en/) is installed.
|
||||
In a new terminal window run the following commands:
|
||||
|
||||
```bash
|
||||
@@ -216,8 +266,14 @@ npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
If you want to recompile the server automatically when code changes:
|
||||
|
||||
```sh
|
||||
$ cd ./ui
|
||||
$ npm mon
|
||||
```
|
||||
|
||||
The site can now be accessed at [localhost:1234](http://localhost:1234).
|
||||
And the graphql playground at [localhost:4001](http://localhost:4001)
|
||||
|
||||
## Sponsors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user