This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build 2.2.0: Added resources for using QEWD Docker Container with Con…
…duit
- Loading branch information
Showing
5 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Using the Docker Version of QEWD with QEWD-Conduit | ||
|
||
- Install Docker | ||
- On your host server, create a directory for the docker-specific control files, eg ~/qewd-docker-files | ||
|
||
## If you want to use the React/Redux version of the RealWorld Conduit front-end | ||
|
||
- copy custom-React-REST.js to the directory you created, and rename it to custom,js, eg | ||
|
||
~/qewd-docker-files/custom.js | ||
|
||
## If you want to use the pre-built WebSocket version of the RealWorld Conduit front-end that comes with QEWD-conduit | ||
|
||
- copy custom-websocket-UI.js to the directory you created, and rename it to custom,js, eg | ||
|
||
~/qewd-docker-files/custom.js | ||
|
||
|
||
## Copy routes.js to the same directory, eg: | ||
|
||
~/qewd-docker-files/routes.js | ||
|
||
|
||
|
||
## Start the Docker version of QEWD: | ||
|
||
replace {username} with the home username for your server | ||
|
||
sudo docker run -it -p 8080:8080 --link redis:redis -v /home/{username}/qewd-docker-files:/opt/qewd/mapped rtweed/qewd | ||
|
||
If you want to run silently as a daemon, replace the -it option with -d | ||
|
||
|
||
If you're using a Raspberry Pi, use this instead: | ||
|
||
sudo docker run -it -p 8080:8080 --link redis:redis -v /home/{username}/qewd-docker-files:/opt/qewd/mapped rtweed/rpi-qewd | ||
|
||
If you want to run silently as a daemon, replace the -it option with -d | ||
|
||
|
||
## Start the UI in a browser | ||
|
||
http://{ip-address}:8080/index.html | ||
|
||
You're now running the RealWorld Conduit front-end against a dockerised version of QEWD.js | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Set up an instance of the REST-based RealWorld Conduit application | ||
|
||
var serverAddress = '192.168.1.122:8080'; | ||
|
||
function customise(config, q, intercept) { | ||
var cp = require('child_process'); | ||
|
||
// install the qewd-conduit back-end | ||
|
||
cp.execSync('npm install qewd-conduit',{stdio:[0,1,2]}); | ||
|
||
// download a pre-built copy of React/Redux version of REST-based Conduit UI | ||
|
||
cp.execSync('wget https://s3.amazonaws.com/mgateway/conduit/conduit.zip',{stdio:[0,1,2]}); | ||
|
||
// install Node.js module for unzipping files | ||
|
||
cp.execSync('npm install extract-zip',{stdio:[0,1,2]}); | ||
var unzip = require('extract-zip'); | ||
|
||
// Unzip the UI, copying the extracted files to the QEWD Web Server root path | ||
|
||
unzip('/opt/qewd/conduit.zip', { dir: '/opt/qewd/www' }, function (err) { | ||
|
||
// Once it's all unzipped, modify the UI's bundled JS file so it points REST requests at our QEWD Container | ||
|
||
cp.execSync('sed -i s/192.168.1.122:8080/' + serverAddress + '/g /opt/qewd/www/static/js/main.d4022d9e.js',{stdio:[0,1,2]}); | ||
console.log('*** Ready for use ***'); | ||
}) | ||
|
||
} | ||
|
||
module.exports = { | ||
run: customise | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Using the WebSockets version of the Conduit UI | ||
|
||
var serverAddress = '192.168.1.122:8080'; | ||
|
||
function customise(config, q, intercept) { | ||
var cp = require('child_process'); | ||
|
||
// install qewd-conduit back-end module | ||
|
||
cp.execSync('npm install qewd-conduit',{stdio:[0,1,2]}); | ||
|
||
// copy the UI from the repo that we've just installed into the QEWD Web Server root path | ||
|
||
cp.execSync('cp -R /opt/qewd/node_modules/qewd-conduit/www/* /opt/qewd/www',{stdio:[0,1,2]}); | ||
|
||
// change the UI logic's IP address to that of this server | ||
|
||
cp.execSync('sed -i s/178.62.26.29:8080/' + serverAddress + '/g /opt/qewd/www/bundle.js',{stdio:[0,1,2]}); | ||
console.log('*** Ready for use ***'); | ||
} | ||
|
||
module.exports = { | ||
run: customise | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = [ | ||
{ | ||
path: '/api', | ||
module: 'qewd-conduit' | ||
} | ||
]; |