Skip to content

Commit

Permalink
Redis session store - redis configuration settings (#12)
Browse files Browse the repository at this point in the history
* Redis session store - redis configuration settings

* Minor bugfix when creating new auth servers

* Better support for feature branch builds.

* Bugfix: sessionStore settings were not written out to globals.json. See Haufe-Lexware/wicked.haufe.io#83

* Redis sessionstore - default to "file" for localhost env
  • Loading branch information
DonMartin76 authored Sep 15, 2017
1 parent 34a4ca5 commit e816b54
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Kickstarter",
"program": "${workspaceRoot}/bin/kickstart",
"args": [
"/home/achim/workspace/wicked/wicked-config/"
]
}
]
}
2 changes: 1 addition & 1 deletion Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ${DOCKER_PREFIX}portal-env:${DOCKER_TAG}-onbuild${BUILD_ALPINE}
FROM ${DOCKER_PREFIX}portal-env:${PORTAL_ENV_TAG}${BUILD_ALPINE}

USER root

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This README is intentionally left without content.

## License

Copyright 2016 Haufe-Lexware GmbH & Co. KG
Copyright 2016-2017 Haufe-Lexware GmbH & Co. KG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 14 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ if [ -z "$DOCKER_TAG" ]; then
export DOCKER_TAG=dev
fi

if [[ "haufelexware/wicked." == "$DOCKER_PREFIX" ]] && [[ "$1" == "--push" ]]; then
echo "INFO: Resolving portal-env base tag for target tag ${DOCKER_TAG}..."
docker pull haufelexware/wicked.portal-env:next-onbuild-alpine
export PORTAL_ENV_TAG=$(docker run --rm haufelexware/wicked.portal-env:next-onbuild-alpine node node_modules/portal-env/getMatchingTag.js haufelexware wicked.portal-env ${DOCKER_TAG})
if [ -z "$PORTAL_ENV_TAG" ]; then
echo "ERROR: Could not resolve portal-env base tag!"
exit 1
fi
else
export PORTAL_ENV_TAG=${DOCKER_TAG}-onbuild
fi

echo "INFO: Using base image tag ${PORTAL_ENV_TAG}"

echo "============================================"
echo "Building normal image..."
echo "============================================"
Expand Down
1 change: 1 addition & 0 deletions routes/ipconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ router.post('/', function (req, res, next) {
var envVars = utils.loadEnvDict(req.app);
glob.network = body.glob.network;
glob.db = body.glob.db;
glob.sessionStore = body.glob.sessionStore;

utils.mixoutEnv(glob, envVars);

Expand Down
10 changes: 8 additions & 2 deletions routes/res/docker-compose.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '2'
services:

publb:
image: dockercloud/haproxy:{{haProxyVersion}}
image: haproxy:{{haProxyVersion}}
ports:
- "443:443"
- "1936:1936"
Expand Down Expand Up @@ -83,6 +83,7 @@ services:
image: {{{dockerPrefix}}}portal:{{dockerTag}}{{buildAlpine}}
depends_on:
- "portal-api"
- "portal-redis"
expose:
- "3000"
environment:
Expand All @@ -92,6 +93,11 @@ services:
- "DEBUG"
restart: unless-stopped

portal-redis:
image: redis:{{redisVersion}}
expose:
- "6379"

portal-kong-adapter:
image: {{{dockerPrefix}}}portal-kong-adapter:{{dockerTag}}{{buildAlpine}}
depends_on:
Expand All @@ -115,4 +121,4 @@ services:
depends_on:
- "portal-api"
environment:
- DEBUG
- DEBUG
5 changes: 3 additions & 2 deletions routes/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ utils.createEnv = function (app, newEnvId) {
PORTAL_NETWORK_APIHOST: { value: '${LOCAL_IP}:8000' },
PORTAL_NETWORK_PORTALHOST: { value: '${LOCAL_IP}:3000' },
PORTAL_NETWORK_SCHEMA: { value: 'http' },
PORTAL_PORTAL_URL: { value: 'http://${LOCAL_IP}:3000' }
PORTAL_PORTAL_URL: { value: 'http://${LOCAL_IP}:3000' },
PORTAL_SESSIONSTORE_TYPE: { type: 'file' }
};
}
fs.writeFileSync(envFileName, JSON.stringify(envDict, null, 2), 'utf8');
Expand Down Expand Up @@ -1050,7 +1051,7 @@ utils.createAuthServer = function (app, serverName) {
api: {
name: serverName,
upstream_url: 'http://auth-server:3005',
uris: '/auth-server',
uris: ['/auth-server'],
preserve_host: false,
strip_uri: false,
},
Expand Down
8 changes: 6 additions & 2 deletions views/deploy.jade
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ block content
or specify your own builds of the API Portal container images.

.form-group
label HA Proxy Version: (<a href="https://hub.docker.com/r/dockercloud/haproxy/tags/" target="_blank">Tags</a>)
input(type="text" name="haProxyVersion" value="1.6.7").form-control
label HA Proxy Version: (<a href="https://hub.docker.com/r/library/haproxy/tags/" target="_blank">Tags</a>)
input(type="text" name="haProxyVersion" value="1.6.13").form-control

.form-group
label PostgreSQL Version: (<a href="https://hub.docker.com/r/library/postgres/tags/" target="_blank">Tags</a>)
input(type="text" name="postgresVersion" value="9.6").form-control

.form-group
label Redis Version: (<a href="https://hub.docker.com/r/library/redis/tags/" target="_blank">Tags</a>)
input(type="text" name="redisVersion" value="3.2.10-alpine").form-control

.form-group
label Docker Base Image prefix:
input(type="text" name="dockerPrefix" value="haufelexware/wicked.").form-control
Expand Down
9 changes: 9 additions & 0 deletions views/ipconfig.jade
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,14 @@ block content
+inputField('glob.network.kongAdminUrl', glob, 'Kong Management URL:', 'string', 'The Kong Admin URL (usually port 8001), as seen from behind the load balancer.', 'PORTAL_KONG_ADMIN_URL')
+inputField('glob.network.mailerUrl', glob, 'Mailer URL:', 'string', 'The URL under which the Mailer component can be reached (behind the load balancer).', 'PORTAL_MAILER_URL')
+inputField('glob.network.chatbotUrl', glob, 'Chatbot URL:', 'string', 'The URL under which the Chatbot component can be reached (behind the load balancer).', 'PORTAL_CHATBOT_URL')

hr

p <b>Redis configuration</b>

+inputField('glob.sessionStore.type', glob, 'Session Store type:', 'string', 'The portal session store type, <code>redis</code> or <code>file</code> is supported')
+inputField('glob.sessionStore.host', glob, 'Redis Host:', 'string', 'The Redis host (if applicable)')
+inputField('glob.sessionStore.port', glob, 'Redis Port:', 'string', 'The Redis port (if applicable, 6739 is default)')
+inputField('glob.sessionStore.password', glob, 'Redis Password:', 'string', 'The Redis password (if applicable, leave empty to not use a password)')

+renderButtons('/ipconfig', '/envs', '/deploy')
2 changes: 1 addition & 1 deletion views/layout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ html
// | <strong>Environment File: </strong><code>#{envFile}</code>
table(width='100%')
tr
td(style='text-align:left; color: #999999;') &copy; 2016 Haufe-Lexware GmbH &amp; Co. KG
td(style='text-align:left; color: #999999;') &copy; 2016-2017 Haufe-Lexware GmbH &amp; Co. KG
td(style='text-align:right; color:#999999;')
| Built by <a href='http://www.haufe-lexware.com' target='_blank'>Haufe-Lexware</a>, powered by <a href='http://getkong.org' target='_blank'>Mashape Kong</a>.

Expand Down

0 comments on commit e816b54

Please sign in to comment.