This commit is contained in:
@@ -13,5 +13,5 @@ COPY --chmod=0755 output/simple_object_storage.${TARGETARCH} /sos/sos
|
|||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# Run server (assuming config is mounted at /data/config.json)
|
# Run server (assuming config is mounted at /data/sos_config.json)
|
||||||
CMD ["/sos/sos"]
|
CMD ["/sos/sos"]
|
@@ -39,7 +39,7 @@ docker build -t simple-object-storage .
|
|||||||
docker run -d \
|
docker run -d \
|
||||||
-p 8080:8080 \
|
-p 8080:8080 \
|
||||||
-v /path/to/storage:/data/storage \
|
-v /path/to/storage:/data/storage \
|
||||||
-v /path/to/config.json:/data/sos_config.json:ro \
|
-v /path/to/sos_config.json:/data/sos_config.json:ro \
|
||||||
--name object-storage \
|
--name object-storage \
|
||||||
simple-object-storage
|
simple-object-storage
|
||||||
```
|
```
|
||||||
@@ -50,7 +50,7 @@ This will:
|
|||||||
- Mount your config directory to the container
|
- Mount your config directory to the container
|
||||||
- Run the service in detached mode
|
- Run the service in detached mode
|
||||||
|
|
||||||
Ensure that the `storage_path` set in the `config.json` is `/data/storage`, the path inside the container.
|
Ensure that the `storage_path` set in the `sos_config.json` is `/data/storage`, the path inside the container.
|
||||||
|
|
||||||
### Using Docker Compose
|
### Using Docker Compose
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ services:
|
|||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/storage:/data/storage
|
- /path/to/storage:/data/storage
|
||||||
- /path/to/config.json:/data/sos_config.json:ro
|
- /path/to/sos_config.json:/data/sos_config.json:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ docker-compose up -d
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The server can be configured by creating a JSON configuration file at `~/.config/simple_object_storage/config.json`. Default values are shown below (everything but write tokens), suitable for running in Docker.
|
The server can be configured by creating a JSON configuration file at `~/.config/simple_object_storage/sos_config.json`. Default values are shown below (everything but write tokens), suitable for running in Docker.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@@ -25,8 +25,8 @@ std::filesystem::path get_config_path() {
|
|||||||
// check for config in the following paths:
|
// check for config in the following paths:
|
||||||
std::vector<std::filesystem::path> config_paths = {
|
std::vector<std::filesystem::path> config_paths = {
|
||||||
"/data/sos_config.json",
|
"/data/sos_config.json",
|
||||||
_home / ".config/simple_object_storage/config.json",
|
_home / ".config/simple_object_storage/sos_config.json",
|
||||||
_exe / ".." / ".test" / "config.json",
|
"sos_config.json",
|
||||||
"/testing/sos_config.json"
|
"/testing/sos_config.json"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ docker buildx build --no-cache --load -t gitea.jde.nz/public/simple-object-stora
|
|||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
# run the docker container
|
# run the docker container
|
||||||
title "Running docker container"
|
title "Running docker container"
|
||||||
export LOCALCONFIG="${SCRIPT_DIR}/config.json"
|
export LOCALCONFIG="${SCRIPT_DIR}/sos_config.json"
|
||||||
export COMPOSE_FILE="${SCRIPT_DIR}/compose.yaml"
|
export COMPOSE_FILE="${SCRIPT_DIR}/compose.yaml"
|
||||||
|
|
||||||
[ -f "${LOCALCONFIG}" ] || die "Config file not found: ${LOCALCONFIG}"
|
[ -f "${LOCALCONFIG}" ] || die "Config file not found: ${LOCALCONFIG}"
|
||||||
@@ -66,8 +66,11 @@ export COMPOSE_FILE="${SCRIPT_DIR}/compose.yaml"
|
|||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
title "Running tests"
|
title "Running tests"
|
||||||
|
|
||||||
|
PREV_DIR=$(pwd)
|
||||||
|
cd "${SCRIPT_DIR}"
|
||||||
|
|
||||||
docker stop sos-test || true
|
docker stop sos-test || true
|
||||||
docker rm sos-test || true
|
docker rm -v sos-test || true
|
||||||
|
|
||||||
LOCALCONFIG=${LOCALCONFIG} docker compose -f "${COMPOSE_FILE}" up -d
|
LOCALCONFIG=${LOCALCONFIG} docker compose -f "${COMPOSE_FILE}" up -d
|
||||||
|
|
||||||
@@ -77,7 +80,6 @@ if ! wait_for_container "sos-test"; then
|
|||||||
echo "Container sos-test is not healthy"
|
echo "Container sos-test is not healthy"
|
||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
docker logs sos-test
|
docker logs sos-test
|
||||||
docker inspect sos-test
|
|
||||||
die "Container sos-test is not healthy"
|
die "Container sos-test is not healthy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -89,5 +91,7 @@ RESULT=$?
|
|||||||
docker compose -f "${COMPOSE_FILE}" down
|
docker compose -f "${COMPOSE_FILE}" down
|
||||||
docker compose -f "${COMPOSE_FILE}" rm -v
|
docker compose -f "${COMPOSE_FILE}" rm -v
|
||||||
|
|
||||||
|
cd "${PREV_DIR}"
|
||||||
|
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
|
|
||||||
|
@@ -53,8 +53,8 @@ if ! command -v jq &> /dev/null; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# read ~/.config/simple_object_storage/config.json
|
# read sos_config.json
|
||||||
CONFIG_PATH="${SCRIPT_DIR}/config.json"
|
CONFIG_PATH="${SCRIPT_DIR}/sos_config.json"
|
||||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||||
echo "config file not found at ${CONFIG_PATH}"
|
echo "config file not found at ${CONFIG_PATH}"
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
# read ~/.config/simple_object_storage/config.json
|
# read ~/.config/simple_object_storage/sos_config.json
|
||||||
CONFIG_PATH="./config.json"
|
CONFIG_PATH="./sos_config.json"
|
||||||
if [ ! -f "${CONFIG_PATH}" ]; then
|
if [ ! -f "${CONFIG_PATH}" ]; then
|
||||||
echo "config file not found at ${CONFIG_PATH}"
|
echo "config file not found at ${CONFIG_PATH}"
|
||||||
exit 1
|
exit 1
|
||||||
|
Reference in New Issue
Block a user