Commit 6f5e6b69 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added configuration over CWMP

parent 1df0e7ac
all: lakeFS-service
all: lakeFS-service lakeFS-config
dd if=/dev/zero of=swap bs=1048576 count=2048
chmod 600 swap
mkswap swap
......@@ -24,6 +24,12 @@ all: lakeFS-service
@echo "$$LAKEFS_SERVICE" > /lib/systemd/system/lakefs.service
systemctl enable lakefs.service
@echo "$$LAKEFS_CONFIG" > /etc/config/lakefs
install -v -Dm755 lakefs /usr/share/easycwmp/functions
@echo "d /run/lakefs 0755 root root -" > /usr/lib/tmpfiles.d/lakefs.conf
install -v -Dm755 lakefs-init /usr/sbin/lakefs-init
rm -rf lakefs-home
umount /tmp
rm -rf tmp
......@@ -47,10 +53,19 @@ Wants=network-online.target
Type=simple
User=root
Group=root
ExecStart=/usr/bin/lakefs
ExecStartPre=/usr/sbin/lakefs-init
ExecStart=/usr/bin/lakefs --config /run/lakefs/config.yaml run
Restart=on-failure
[Install]
WantedBy=multi-user.target
endef
export LAKEFS_SERVICE
lakeFS-config:
define LAKEFS_CONFIG
config lakefs 'auth'
option secretkey ''
endef
export LAKEFS_CONFIG
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.LakeFS."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_LakeFS"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_LakeFS"
entry_execute_method_root_LakeFS() {
case "$1" in ""|"$DMROOT."|"$DMROOT.LakeFS."*)
common_execute_method_obj "$DMROOT.LakeFS." "0"
common_execute_method_param "$DMROOT.LakeFS.AuthSecretKey" "1" "" "lakefs_set_authsecretkey"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
lakefs_set_authsecretkey() {
local secretkey=`$UCI_GET lakefs.auth.secretkey`
if [ "$secretkey" != "$1" ]; then
$UCI_SET lakefs.auth.secretkey="$1"
$UCI_COMMIT
chmod a+r /etc/config/lakefs
fi
}
#!/bin/sh
SERVER=`/sbin/uci -q get mongodb.credentials.hostname`
DATABASE=`/sbin/uci -q get mongodb.credentials.database`
USER=`/sbin/uci -q get mongodb.credentials.username`
PASSWORD=`/sbin/uci -q get mongodb.credentials.password`
AUTH_SECRET_KEY=`/sbin/uci -q get lakefs.auth.secretkey`
S3_URI=`/sbin/uci -q get s3.credentials.uri`
ACCESS_KEY=`/sbin/uci -q get s3.credentials.accesskey`
SECRET_KEY=`/sbin/uci -q get s3.credentials.secretkey`
if [ ! -z "$SERVER" ] && [ ! -z "$DATABASE" ] && [ ! -z "$AUTH_SECRET_KEY" ] && [ ! -z "$ACCESS_KEY" ] && [ ! -z "$SECRET_KEY" ]; then
echo "---" > /run/lakefs/config.yaml
echo "database:" > /run/lakefs/config.yaml
echo " type: \"postgres\"" > /run/lakefs/config.yaml
echo " postgres:" > /run/lakefs/config.yaml
if [ ! -z "$USER" ] && [ ! -z "$PASSWORD" ]; then
echo " connection_string: postgresql://$USER:$PASSWORD@$SERVER/$DATABASE" > /run/lakefs/config.yaml
else
echo " connection_string: postgresql://$SERVER/$DATABASE" > /run/lakefs/config.yaml
fi
echo "auth:" > /run/lakefs/config.yaml
echo " encrypt:" > /run/lakefs/config.yaml
echo " secret_key: $AUTH_SECRET_KEY" > /run/lakefs/config.yaml
echo "blockstore:" > /run/lakefs/config.yaml
echo " type: s3" > /run/lakefs/config.yaml
echo " s3:" > /run/lakefs/config.yaml
echo " force_path_style: true" > /run/lakefs/config.yaml
if [ ! -z "$S3_URI" ]; then
echo " endpoint: $S3_URI" > /run/lakefs/config.yaml
fi
echo " discover_bucket_region: false" > /run/lakefs/config.yaml
echo " credentials:" > /run/lakefs/config.yaml
echo " access_key_id: \"$ACCESS_KEY\"" > /run/lakefs/config.yaml
echo " secret_access_key: \"$SECRET_KEY\"" > /run/lakefs/config.yaml
else
exit 1
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment