Local Kubernetes via Kind
$ kind create cluster --name local
Local Postgres via Docker
$ docker run -d -p 5432:5432 -e "POSTGRES_USER=root" -e "POSTGRES_PASSWORD=Root123" -e "POSTGRES_DB=walrus" postgres:16.1
Local MinIO via Docker
$ mkdir -p ${HOME}/minio/data
$ docker run -d \
-p 9000:9000 \
--name minio \
-v ~/minio/data:/data \
-e "MINIO_ROOT_USER=minio" \
-e "MINIO_ROOT_PASSWORD=Minio123" \
docker.io/minio/minio server /dataLocal Casdoor via Docker
$ docker run -d -p 8000:8000 sealio/casdoor:v1.515.0-seal.1
(Optional) Local Redis via Docker
$ docker run -d -p 6379:6379 redis:6.2.11 redis-server --save "" --appendonly no --databases 1 --requirepass Default123
$ # default.
$ go run cmd/server/server.go --log-debug \
--data-source-address="postgres://root:Root123@127.0.0.1:5432/walrus?sslmode=disable" \
--s3-source-address="s3://minio:minio@localhost:9000/walrus?sslmode=disable" \
--casdoor-server="http://127.0.0.1:8000"
$ # with cache data source.
$ go run cmd/server/server.go --log-debug \
--data-source-address="postgres://root:Root123@127.0.0.1:5432/walrus?sslmode=disable" \
--s3-source-address="s3://minio:minio@localhost:9000/walrus?sslmode=disable" \
--casdoor-server="http://127.0.0.1:8000" \
--cache-source-address="redis://default:Default123@127.0.0.1:6379/0"
Interact with HTTPie
$ # get init password from console: !!! Bootstrap Admin Password: <here> !!!
$ https --verify=no POST :/account/login username=admin password=<password>
$ # access with login session.
$ https --verify=no GET :/settings Cookie:walrus_session=<response from above request>
Interact with Swagger UI
$ open http://127.0.0.1/swagger
The Makefile includes some useful commands for development. You can build locally using the make command. You can run make help for details. The output is shown as below.
$ make help
#
# Usage:
#
# * [dev] `make deps`, get dependencies.
#
# * [dev] `make generate`, generate something.
#
# * [dev] `make lint`, check style.
# - `BUILD_TAGS="jsoniter" make lint` check with specified tags.
# - `LINT_DIRTY=true make lint` verify whether the code tree is dirty.
#
# * [dev] `make test`, execute unit testing.
# - `BUILD_TAGS="jsoniter" make test` test with specified tags.
#
# * [dev] `make build`, execute cross building.
# - `VERSION=vX.y.z+l.m make build` build all targets with vX.y.z+l.m version.
# - `OS=linux ARCH=arm64 make build` build all targets run on linux/arm64 arch.
# - `BUILD_TAGS="jsoniter" make build` build with specified tags.
# - `BUILD_PLATFORMS="linux/amd64,linux/arm64" make build` do multiple platforms go build.
#
# * [dev] `make package`, embed running resources into a Docker image on one platform.
# - `REPO=xyz make package` package all targets named with xyz repository.
# - `VERSION=vX.y.z+l.m make package` package all targets named with vX.y.z-l.m tag.
# - `TAG=main make package` package all targets named with main tag.
# - `OS=linux ARCH=arm64 make package` package all targets run on linux/arm64 arch.
# - `PACKAGE_BUILD=false make package` prepare build resource but disable docker build.
# - `DOCKER_USERNAME=... DOCKER_PASSWORD=... PACKAGE_PUSH=true make package` execute docker push after build.
#
# * [ci] `make ci-check`, execute `make deps`, `make test` and `make lint`.
#
# * [ci] `make ci-publish`, execute `make build` and `make package`.
#