这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM golang:1.17.5-bullseye

ARG VERSION

ENV GOPATH /go

COPY . ${GOPATH}/src/github.com/mosuka/phalanx

RUN apt-get update \
&& apt-get install -y \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN cd ${GOPATH}/src/github.com/mosuka/phalanx \
&& make VERSION=${VERSION} build


FROM debian:bullseye-slim

RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd -r phalanx && useradd -r -g phalanx phalanx
USER phalanx

COPY --from=0 --chown=phalanx:phalanx /go/src/github.com/mosuka/phalanx/bin/* /usr/bin/

EXPOSE 2000 5000 8000

ENTRYPOINT [ "/usr/bin/phalanx" ]
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CGO_LDFLAGS ?=
BUILD_TAGS ?=
VERSION ?=
BIN_EXT ?=
DOCKER_REPOSITORY ?= mosuka

PACKAGES = $(shell $(GO) list ./... | grep -v '/vendor/')

Expand Down Expand Up @@ -83,6 +84,32 @@ build: show-env
mkdir -p bin
$(GO) build $(LDFLAGS) -o bin/phalanx

.PHONY: tag
tag: show-env
@echo ">> tagging github"
ifeq ($(VERSION),$(filter $(VERSION),latest master ""))
@echo "please specify VERSION"
else
git tag -a $(VERSION) -m "Release $(VERSION)"
git push origin $(VERSION)
endif

.PHONY: docker-build
docker-build: show-env
@echo ">> building docker container image"
docker build -t $(DOCKER_REPOSITORY)/phalanx:latest --build-arg VERSION=$(VERSION) .
docker tag $(DOCKER_REPOSITORY)/phalanx:latest $(DOCKER_REPOSITORY)/phalanx:$(VERSION)

.PHONY: docker-push
docker-push: show-env
@echo ">> pushing docker container image"
docker push $(DOCKER_REPOSITORY)/phalanx:latest
docker push $(DOCKER_REPOSITORY)/phalanx:$(VERSION)

.PHONY: docker-clean
docker-clean: show-env
docker rmi -f $(shell docker images --filter "dangling=true" -q --no-trunc)

.PHONY: cert
cert: show-env
@echo ">> generating certification"
Expand Down
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ Metrics for system operation can also be output in Prometheus exposition format,
Phalanx is using object storage for the storage layer, it is only responsible for the computation layer, such as indexing and retrieval processes. Therefore, scaling is easy, and you can simply add new nodes to the cluster.
Currently, it is an alpha version and only supports [MinIO](https://min.io/) as the storage layer, but in the future it will support [Amazon S3](https://aws.amazon.com/s3/), [Google Cloud Storage](https://cloud.google.com/storage), and [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs/).


## Build

Building Phalanx as following:

```bash
% git clone https://github.com/mosuka/phalanx.git
% cd phalanx
% make build
```


## Binary

You can see the binary file when build successful like so:

```bash
$ ls ./bin
phalanx
```


## Start Phalanx on local machine with local file system

Phalanx can be started on a local machine as if it were using local storage instead of object storage.
Expand All @@ -15,6 +37,7 @@ A configuration file is available for starting on the local machine. You can sta
% phalanx --config-file=./examples/phalanx_local.yml
```


## Start Phalanx on local machine with MinIO and etcd

To experience the features of Phalanx, let's try to start Phalanx using MinIO and etcd.
Expand Down Expand Up @@ -72,6 +95,7 @@ This instructs each new node to join an existing node, each node recognizes the

There are endpoints, but it is not yet fully implemented.


## Metrics exposition

```
Expand All @@ -86,6 +110,7 @@ phalanx_grpc_server_handled_total{grpc_code="Aborted",grpc_method="Cluster",grpc
...
```


## Cluster status

```
Expand Down Expand Up @@ -115,6 +140,7 @@ phalanx_grpc_server_handled_total{grpc_code="Aborted",grpc_method="Cluster",grpc
}
```


## Create index

### Create index on local file system
Expand All @@ -135,24 +161,28 @@ If you have started Phalanx to use MinIO and etcd, use this command to create th

The difference between the above commands is the difference between `index_uri` and `lock_uri` in the configuration file. This parameter specifies where the index and its lock file will be created.


## Delete index

```
% curl -XDELETE http://localhost:8000/v1/indexes/example_en
```


## Add / Update documents

```
% curl -XPUT -H 'Content-type: application/x-ndjson' http://localhost:8000/v1/indexes/example_en/documents --data-binary @./examples/add_documents.ndjson
```


## Delete documents

```
% curl -XDELETE -H 'Content-type: text/plain' http://localhost:8000/v1/indexes/example_en/documents --data-binary @./examples/delete_ids.txt
```


## Search

```
Expand Down Expand Up @@ -297,3 +327,42 @@ The difference between the above commands is the difference between `index_uri`
"index_name": "example_en"
}
```


## Docker container

### Build Docker container image

You can build the Docker container image like so:

```
% make docker-build
```

### Pull Docker container image from docker.io

You can also use the Docker container image already registered in docker.io like so:

```
% docker pull mosuka/phalanx:latest
```

See https://hub.docker.com/r/mosuka/phalanx/tags/

### Start on Docker

Running a Blast data node on Docker. Start Blast node like so:

```bash
$ docker run --rm --name phalanx-node1 \
-p 2000:2000 \
-p 5000:5000 \
-p 8000:8000 \
mosuka/phalanx:latest start \
--host=0.0.0.0 \
--bind-port=2000 \
--grpc-port=5000 \
--http-port=8000 \
--roles=indexer,searcher \
--index-metastore-uri=file:///tmp/phalanx/metadata
```