diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-08-06 22:02:23 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-08-06 22:02:23 +0300 |
commit | bb4fde63743e78ae6cc6e7c083fa978d6de60a18 (patch) | |
tree | 98294919bf47a8b51a15cfdbd492b19e8fe56d6a /snap-src/bin | |
parent | 74a4b28313e9cfedcb927e4496c0dd3800b1e6f9 (diff) | |
download | wekan-bb4fde63743e78ae6cc6e7c083fa978d6de60a18.tar.gz wekan-bb4fde63743e78ae6cc6e7c083fa978d6de60a18.tar.bz2 wekan-bb4fde63743e78ae6cc6e7c083fa978d6de60a18.zip |
Try to fix Snap MongoDB.
Diffstat (limited to 'snap-src/bin')
-rwxr-xr-x | snap-src/bin/config | 10 | ||||
-rwxr-xr-x | snap-src/bin/mongodb-control | 36 | ||||
-rwxr-xr-x | snap-src/bin/mongodb-restore | 3 | ||||
-rwxr-xr-x | snap-src/bin/wekan-help | 5 |
4 files changed, 36 insertions, 18 deletions
diff --git a/snap-src/bin/config b/snap-src/bin/config index 551c9fde..1d5ac781 100755 --- a/snap-src/bin/config +++ b/snap-src/bin/config @@ -3,17 +3,21 @@ # All supported keys are defined here together with descriptions and default values # list of supported keys -keys="DEBUG MONGODB_BIND_UNIX_SOCKET MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB CADDY_ENABLED CADDY_BIND_PORT WITH_API RICHER_CARD_COMMENT_EDITOR ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW MAX_IMAGE_PIXEL IMAGE_COMPRESS_RATIO BIGEVENTS_PATTERN NOTIFY_DUE_DAYS_BEFORE_AND_AFTER NOTIFY_DUE_AT_HOUR_OF_DAY EMAIL_NOTIFICATION_TIMEOUT CORS CORS_ALLOW_HEADERS CORS_EXPOSE_HEADERS MATOMO_ADDRESS MATOMO_SITE_ID MATOMO_DO_NOT_TRACK MATOMO_WITH_USERNAME BROWSER_POLICY_ENABLED TRUSTED_URL WEBHOOKS_ATTRIBUTES OAUTH2_ENABLED OAUTH2_LOGIN_STYLE OAUTH2_CLIENT_ID OAUTH2_SECRET OAUTH2_SERVER_URL OAUTH2_AUTH_ENDPOINT OAUTH2_USERINFO_ENDPOINT OAUTH2_TOKEN_ENDPOINT OAUTH2_ID_MAP OAUTH2_USERNAME_MAP OAUTH2_FULLNAME_MAP OAUTH2_ID_TOKEN_WHITELIST_FIELDS OAUTH2_EMAIL_MAP OAUTH2_REQUEST_PERMISSIONS LDAP_ENABLE LDAP_PORT LDAP_HOST LDAP_BASEDN LDAP_LOGIN_FALLBACK LDAP_RECONNECT LDAP_TIMEOUT LDAP_IDLE_TIMEOUT LDAP_CONNECT_TIMEOUT LDAP_AUTHENTIFICATION LDAP_AUTHENTIFICATION_USERDN LDAP_AUTHENTIFICATION_PASSWORD LDAP_LOG_ENABLED LDAP_BACKGROUND_SYNC LDAP_BACKGROUND_SYNC_INTERVAL LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS LDAP_ENCRYPTION LDAP_CA_CERT LDAP_REJECT_UNAUTHORIZED LDAP_USER_AUTHENTICATION LDAP_USER_AUTHENTICATION_FIELD LDAP_USER_SEARCH_FILTER LDAP_USER_SEARCH_SCOPE LDAP_USER_SEARCH_FIELD LDAP_SEARCH_PAGE_SIZE LDAP_SEARCH_SIZE_LIMIT LDAP_GROUP_FILTER_ENABLE LDAP_GROUP_FILTER_OBJECTCLASS LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT LDAP_GROUP_FILTER_GROUP_NAME LDAP_UNIQUE_IDENTIFIER_FIELD LDAP_UTF8_NAMES_SLUGIFY LDAP_USERNAME_FIELD LDAP_FULLNAME_FIELD LDAP_MERGE_EXISTING_USERS LDAP_SYNC_USER_DATA LDAP_SYNC_USER_DATA_FIELDMAP LDAP_SYNC_GROUP_ROLES LDAP_DEFAULT_DOMAIN LDAP_EMAIL_MATCH_ENABLE LDAP_EMAIL_MATCH_REQUIRE LDAP_EMAIL_MATCH_VERIFIED LDAP_EMAIL_FIELD LDAP_SYNC_ADMIN_STATUS LDAP_SYNC_ADMIN_GROUPS HEADER_LOGIN_ID HEADER_LOGIN_FIRSTNAME HEADER_LOGIN_LASTNAME HEADER_LOGIN_EMAIL LOGOUT_WITH_TIMER LOGOUT_IN LOGOUT_ON_HOURS LOGOUT_ON_MINUTES DEFAULT_AUTHENTICATION_METHOD" +keys="DEBUG MONGO_URL MONGODB_BIND_UNIX_SOCKET MONGO_URL MONGODB_BIND_IP MONGODB_PORT MAIL_URL MAIL_FROM ROOT_URL PORT DISABLE_MONGODB CADDY_ENABLED CADDY_BIND_PORT WITH_API RICHER_CARD_COMMENT_EDITOR ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW MAX_IMAGE_PIXEL IMAGE_COMPRESS_RATIO BIGEVENTS_PATTERN NOTIFY_DUE_DAYS_BEFORE_AND_AFTER NOTIFY_DUE_AT_HOUR_OF_DAY EMAIL_NOTIFICATION_TIMEOUT CORS CORS_ALLOW_HEADERS CORS_EXPOSE_HEADERS MATOMO_ADDRESS MATOMO_SITE_ID MATOMO_DO_NOT_TRACK MATOMO_WITH_USERNAME BROWSER_POLICY_ENABLED TRUSTED_URL WEBHOOKS_ATTRIBUTES OAUTH2_ENABLED OAUTH2_LOGIN_STYLE OAUTH2_CLIENT_ID OAUTH2_SECRET OAUTH2_SERVER_URL OAUTH2_AUTH_ENDPOINT OAUTH2_USERINFO_ENDPOINT OAUTH2_TOKEN_ENDPOINT OAUTH2_ID_MAP OAUTH2_USERNAME_MAP OAUTH2_FULLNAME_MAP OAUTH2_ID_TOKEN_WHITELIST_FIELDS OAUTH2_EMAIL_MAP OAUTH2_REQUEST_PERMISSIONS LDAP_ENABLE LDAP_PORT LDAP_HOST LDAP_BASEDN LDAP_LOGIN_FALLBACK LDAP_RECONNECT LDAP_TIMEOUT LDAP_IDLE_TIMEOUT LDAP_CONNECT_TIMEOUT LDAP_AUTHENTIFICATION LDAP_AUTHENTIFICATION_USERDN LDAP_AUTHENTIFICATION_PASSWORD LDAP_LOG_ENABLED LDAP_BACKGROUND_SYNC LDAP_BACKGROUND_SYNC_INTERVAL LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS LDAP_ENCRYPTION LDAP_CA_CERT LDAP_REJECT_UNAUTHORIZED LDAP_USER_AUTHENTICATION LDAP_USER_AUTHENTICATION_FIELD LDAP_USER_SEARCH_FILTER LDAP_USER_SEARCH_SCOPE LDAP_USER_SEARCH_FIELD LDAP_SEARCH_PAGE_SIZE LDAP_SEARCH_SIZE_LIMIT LDAP_GROUP_FILTER_ENABLE LDAP_GROUP_FILTER_OBJECTCLASS LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT LDAP_GROUP_FILTER_GROUP_NAME LDAP_UNIQUE_IDENTIFIER_FIELD LDAP_UTF8_NAMES_SLUGIFY LDAP_USERNAME_FIELD LDAP_FULLNAME_FIELD LDAP_MERGE_EXISTING_USERS LDAP_SYNC_USER_DATA LDAP_SYNC_USER_DATA_FIELDMAP LDAP_SYNC_GROUP_ROLES LDAP_DEFAULT_DOMAIN LDAP_EMAIL_MATCH_ENABLE LDAP_EMAIL_MATCH_REQUIRE LDAP_EMAIL_MATCH_VERIFIED LDAP_EMAIL_FIELD LDAP_SYNC_ADMIN_STATUS LDAP_SYNC_ADMIN_GROUPS HEADER_LOGIN_ID HEADER_LOGIN_FIRSTNAME HEADER_LOGIN_LASTNAME HEADER_LOGIN_EMAIL LOGOUT_WITH_TIMER LOGOUT_IN LOGOUT_ON_HOURS LOGOUT_ON_MINUTES DEFAULT_AUTHENTICATION_METHOD" # default values DESCRIPTION_DEBUG="Debug OIDC OAuth2 etc. Example: sudo snap set wekan debug='true'" DEFAULT_DEBUG="false" KEY_DEBUG="debug" -DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket:\n"\ +DESCRIPTION_MONGOURL="MONGO_URL. Default: ''" +DEFAULT_MONGO_URL="" +KEY_MONGO_URL='mongo-url' + +DESCRIPTION_MONGODB_BIND_UNIX_SOCKET="mongodb binding unix socket. Example: /var/snap/wekan/current/share . Default: ''\n"\ "\t\t\t Default behaviour will preffer binding over unix socket, to disable unix socket binding set value to 'nill' string\n"\ "\t\t\t To bind to instance of mongodb provided through content interface,set value to relative path to the socket inside '$SNAP_DATA/shared' directory" -DEFAULT_MONGODB_BIND_UNIX_SOCKET="/var/snap/wekan/current/share" +DEFAULT_MONGODB_BIND_UNIX_SOCKET="" KEY_MONGODB_BIND_UNIX_SOCKET="mongodb-bind-unix-socket" DESCRIPTION_MONGODB_PORT="mongodb binding port: eg 27017 when using localhost" diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control index 60d59657..28e58670 100755 --- a/snap-src/bin/mongodb-control +++ b/snap-src/bin/mongodb-control @@ -16,20 +16,28 @@ fi export LC_ALL=C -# start mongo deamon -BIND_OPTIONS="" -if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then - BIND_OPTIONS+=" --unixSocketPrefix $MONGODB_BIND_UNIX_SOCKET" -fi -if [ "x" != "x${MONGODB_BIND_IP}" ]; then - BIND_OPTIONS+=" --bind_ip $MONGODB_BIND_IP" -fi -if [ "x" != "x${MONGODB_PORT}" ]; then - BIND_OPTIONS+=" --port $MONGODB_PORT" -fi -echo "mongodb bind options: $BIND_OPTIONS" +if [ -z "$MONGO_URL" ]; then + + # start mongo deamon + BIND_OPTIONS="" + if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then + BIND_OPTIONS+=" --unixSocketPrefix $MONGODB_BIND_UNIX_SOCKET" + fi + if [ "x" != "x${MONGODB_BIND_IP}" ]; then + BIND_OPTIONS+=" --bind_ip $MONGODB_BIND_IP" + fi + if [ "x" != "x${MONGODB_PORT}" ]; then + BIND_OPTIONS+=" --port $MONGODB_PORT" + fi + echo "mongodb bind options: $BIND_OPTIONS" -mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $BIND_OPTIONS --smallfiles + mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $BIND_OPTIONS --smallfiles + +else + + mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $MONGO_URL --smallfiles + +fi # Drop indexes on database upgrade, when starting MongoDB -mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS +#mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS diff --git a/snap-src/bin/mongodb-restore b/snap-src/bin/mongodb-restore index dddcea20..cbc63437 100755 --- a/snap-src/bin/mongodb-restore +++ b/snap-src/bin/mongodb-restore @@ -13,4 +13,5 @@ export LC_ALL=C # start mongodb backup [ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1" echo "using bind ip" -mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --noIndexRestore --gzip --archive=$1 +mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=$1 +# --noIndexRestore diff --git a/snap-src/bin/wekan-help b/snap-src/bin/wekan-help index faa56f65..c662bf7e 100755 --- a/snap-src/bin/wekan-help +++ b/snap-src/bin/wekan-help @@ -15,6 +15,11 @@ echo -e "\t$ snap set $SNAP_NAME debug='true'" echo -e "\t-Disable the Debug of Wekan:" echo -e "\t$ snap set $SNAP_NAME debug='false'" echo -e "\n" +echo -e "To enable the MONGO_URL of Wekan:" +echo -e "\t$ snap set $SNAP_NAME mongo-url='...'" +echo -e "\t-Disable the MONGO_URL of Wekan:" +echo -e "\t$ snap set $SNAP_NAME mongo-url=''" +echo -e "\n" echo -e "Make sure you have connected all interfaces, check more by calling $ snap interfaces ${SNAP_NAME}" echo -e "\n" echo -e "${SNAP_NAME} has multiple services, to check status use systemctl" |