-
Notifications
You must be signed in to change notification settings - Fork 10
Deploying Attache on Digital Ocean using Docker
This should take you 5 minutes.
Create a Digital Ocean account if you don't have it yet, and login.
- under the
Select Image
section, choose theApplications
tab and selectDocker
- feel free to customize any other settings on the page
Once the droplet is created and available
- If you chose the
Add SSH Keys
option earlier- Copy the ip address assigned to your droplet, e.g. X.X.X.X
- SSH into the server
ssh [email protected]
- Otherwise, click on the
Console access
and login asroot
with your password
Once you're inside the command line of the server, update the packages and install varnish
apt-get update && apt-get install varnish
Reconfigure varnish to listen at port 80
instead of the default 6081
sed -i 's/6081/80/g' /etc/default/varnish
Restart varnish
service varnish restart
Your server is now accepting web requests via varnish which will work with an attache
server running at port 8080
. Except, your attache
server isn't running yet. So let's do that!
docker run -it -p 8080:5000 -d --name attache attache/attache
This will ask Docker to
- download & run attache/attache
- allow us to reference it by name
attache
- and make it listen at port
8080
(hello varnish!)
To stop the attache server (why?)
docker stop attache
To run it again
docker start attache
If you wish to have user uploaded files backed up to a cloud storage, you'll need to setup a VHOST
environment variable
Then stop and remove the old attache
docker stop attache
docker rm attache
Launch a new attache
container with VHOST
env passed in
docker run -it -e VHOST -p 8080:5000 -d --name attache attache/attache
Checkout the demo app
git clone https://github.com/choonkeat/attache-railsapp.git
cd attache-railsapp
bundle
rake db:create db:schema:load
Point the ATTACHE_URL
to your Digital Ocean server and run it
ATTACHE_URL=http://X.X.X.X rails s
Open http://localhost:3000/ and see it in action!