Skip to content

Commit

Permalink
Add development build files
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-root committed Jul 28, 2019
1 parent ed0cdce commit 05b2751
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*.out

# Local build scripts
build-local/

# Output of goreleaser
dist/
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ Example: `LOG_LEVEL=warn`
* `LOG_FORMAT` sets log format. Possible values are `json`, `text`.
Example: `LOG_FORMAT=json`

# Building and running locally
`build-local` directory contains simple scripts to
build and run the server locally with [goreleaser](https://github.com/goreleaser/goreleaser).

`./build-local/build.sh` builds the project.

`./build-local/run.sh` runs the project in development mode.

## Possible improvements
### Features
* Active cleanup of expired keys.
Expand All @@ -44,7 +52,6 @@ Currently memory allocated by list entries is not cleaned up until the list key
* Add graceful server shutdown
* Refine handling of connection read/write errors: which are fine skip and close connection?


## Commands
The list of commands is a subset of Redis commands,
with an attempt to follow the redis commands behavior as close as possible.
Expand Down
6 changes: 6 additions & 0 deletions build-local/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPT_DIR=${DIR}

goreleaser --config=${SCRIPT_DIR}/../.goreleaser.yml --skip-publish --snapshot --rm-dist
6 changes: 6 additions & 0 deletions build-local/local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

export SERVER_PORT="9876"

export LOG_LEVEL="debug" # for prod - "info"
export LOG_FORMAT="text" # for prod - "json"
15 changes: 15 additions & 0 deletions build-local/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPT_DIR=${DIR}

source ${SCRIPT_DIR}/local.sh

UNAME_OUT="$(uname -s)"
case "${UNAME_OUT}" in
Linux*) machine=linux_amd64;;
Darwin*) machine=darwin_amd64;;
*) machine="UNKNOWN:${UNAME_OUT}"
esac

${SCRIPT_DIR}/../dist/${machine}/memcache

0 comments on commit 05b2751

Please sign in to comment.