Ember Client in the cloud - OurDigitalWorld/supplejack-ember GitHub Wiki
WIP
To act as a discovery layer for our Supplejack-Docker in the cloud instance we built an Ember Client in the cloud.
This too, is a DigitalOcean droplet with the following specs:
- SJ3 8GB/80GB Ubuntu LEMP*
[we have since moved this application to a 8GB/80GB RHEL7 LEMP server, make sure your iptables
are configured for the ports below]
If you're running the application without fastboot
On a local version of your client (see the Ember Client page), make sure you change the following variables in environment.js
ENV.APP.host = 'http://SJ1-IP-ADDRESS:3000';
ENV.APP.namespace = '';
ENV.APP.api_key = 'YOUR-API-KEY';
Then run
$ ember build
and load the dist
folder onto you web server with scp
, rsync
or even ftp
.
Assuming you're using nginx on your server, modify your nginx config file:
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ /index.html;
proxy_pass http://127.0.0.1:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
and view the client at your server's ip address
If you're running the application with fastboot
. . .
you again build it locally, but this time when your done:
- remove the
app
folder - remove every dependency from
package.json
exceptfastboot-app-server
andfastboot-watch-notifier
- run
npm prune
- load all the remaining folders/files to your web server
- install node.js, bower, and ember cli on your server
- going forward all updates to the app on the server will now just be a push to the
dist
On you server from the web directory, you can now run:
PORT=8000 node fastboot-server.js
But if you exit the terminal, your application will exit as well. So, you need to run it detached. You could run it as a service, but we run it with screen
$ screen
$ PORT=8000 node fastboot-server.js
CTRL-A then hit D
Your session is now running in the background [and you can exit your terminal]
When you want to look at your session again, login to your webserver and run one of the following commands:
-
screen -r
-
screen -ls
list screens -
screen -X -S [session # you want to kill] quit
-
pkill screen
As an experiment, we skinned slightly different versions of the client, and run three of them from the same webserver.
- change the ports in
package.json
[i.e. 8001, 8002] - load your clients (in subfolders at
/var/www/html
)
run your clients detached via screen
$ screen
$ PORT=800[*] node fastboot-server.js
CTRL-A then hit D