SlideShare uma empresa Scribd logo
1 de 45
Digital Ocean
Meetup
What I do with my $5 (per month actually)
Introduction
About me? Or about Digital Ocean?
What I’m going to talk
about
So why DO?
The Adverts
Price?
Easy?
Performance?
• Sorry no picture.
• Benchmarks gives some indication, but hard to
make it really objective and useful.
• Location. DO has no Asia servers.. yet.
It depends.
Cliché I know.
Experience with DO
• I have a website: www.dilegno.sg
• Some parts of Shoppink use Digital Ocean
• Plus my random stuff I’m going to share with you
Alternatives?
Many.
Setting up DO
One
Two
That’s it!
A website
Recipe
• A personal website.
• Simply get a web server running (apache or nginx)
• My website uses Sinatra.
• We then need to get nginx talking to Sinatra.
Sinatra
• Sinatra is a Ruby micro-framework
• require 'sinatra'
get '/hi' do
"Hello World!"
end
Unicorn
# set path to app that will be used to configure unicorn,
# note the trailing slash in this example
@dir = "/home/sockmister/personal-website/"
worker_processes 1
working_directory @dir
timeout 30
# Specify path to socket unicorn listens to,
# we will use this in our nginx.conf later
listen "#{@dir}tmp/sockets/unicorn.sock", :backlog => 64
# Set process id path
pid "#{@dir}tmp/pids/unicorn.pid"
# Set log file paths
stderr_path "#{@dir}log/unicorn.stderr.log"
stdout_path "#{@dir}log/unicorn.stdout.log"
Nginx
• sudo apt-get install nginx
• We can start, stop, restart by
o sudo service nginx restart|start|stop|status
• We then write the config files.
The Idea
• The apps we are running today run behind nginx.
Nginx
App1
App2
App3
Incoming Requests
Outgoing Replies
Config File
upstream pohchiat{
server unix:/home/sockmister/personal-website/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name www.pohchiat.com;
root /home/sockmister/personal-website/public;
location / {
proxy_pass http://pohchiat;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Done!
Free GitHub repos
Using GitLab
Recipe
• Setup GitLab
o Install dependencies
o Setup new user
o Clone and install GitLab shell
o Setup database (postgresql or mysql)
o Setup GitLab itself
• Hook up with Nginx
Dependencies
• Python 2
o Sudo apt-get install python
• Ruby
o Ubuntu repositories are outdated
o I use rvm to handle ruby versions.
• Gem
o gem install bundler
Adduser
• We need to create a new user called ‘git’.
o sudo adduser --disabled-login --gecos 'GitLab' git
GitLab Shell
• Clone
o sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git
• Git checkout the right version
o sudo -u git -H git checkout v1.7.1
• Edit config file
o sudo -u git -H editor config.yml
• Run a script
o sudo -u git -H ./bin/install
Database
• Install postgresql
o sudo apt-get install -y postgresql-9.1 libpq-dev
• Login
o sudo -u postgres psql -d template1
• Create user and database
o CREATE USER git WITH PASSWORD '$password';
o CREATE DATABASE gitlabhq_production OWNER git;
GitLab
• Clone
o sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
• Git checkout
o sudo -u git -H git checkout 6-1-stable
• Configure
o Copy and change GitLab config file
o Mkdir for logs, tmp, public
o Copy and change unicorn config file
• Install required Gems
o gem install charlock_holmes --version '0.6.9.4'
o bundle install --deployment --without development test mysql aws
• Initialize DB
o sudo -u git -H chmod o-rwx config/database.yml
o bundle exec rake gitlab:setup RAILS_ENV=production
• Run as service
Nginx
• This time GitLab has supplied the Nginx config file.
• The idea though, is really the same.
Done!
E-Book manager
Calibre Library
Calibre Library
This needs a bit of intro.
Calibre Library
Recipe
• Setup calibre app (this time it’s actually really
simple)
• Setup dropbox daemon
• Hook up to Nginx (same!)
Setup Calibre
• sudo python -c "import sys; py3 = sys.version_info[0] > 2; u =
__import__('urllib.request' if py3 else 'urllib', fromlist=1);
exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main()
• To start calibre server,
• Sudo /opt/calibre/calibre-server
• Options:
• --with-library
• --username
• --password
• --daemonize
Dropbox
• I run calibre on my laptop as well.
• Need a simple way to sync the books both ways.
• Trivia: NUS won Dropbox space race a while ago
and all NUS students have 25 GB extra space.
Dropbox
• Download & install
o wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86
o tar –xzvf dropbox.tar.gz
• Run
o ~/.dropbox-dist/dropboxd
• Link to your Dropbox account
o This client is not linked to any account…
• Control Dropbox
o wget -O ~/.dropbox/dropbox.py
"http://www.dropbox.com/download?dl=packages/dropbox.py"
Done!
Caveats
• It’s experimental.
• Just because you can, doesn’t mean you should.
• 512MB RAM
• Erm. I cheated. I paid for domain too.
Takeaway
• Tons of open source projects to try out.
• It’s not a must to run this on DO.
Resources
• Digital Ocean has a lot of guides. A lot a lot.
Otherwise…
• Setup nginx
o http://ruby-journal.com/how-to-setup-rails-app-with-puma-and-nginx/
o http://recipes.sinatrarb.com/p/deployment/nginx_proxied_to_unicorn
• GitLab
o https://github.com/gitlabhq/gitlabhq/blob/6-1-
stable/doc/install/installation.md
• Calibre server
o http://manual.calibre-ebook.com/cli/calibre-server.html
• Dropbox daemon
o http://ubuntuservergui.com/ubuntu-server-guide/install-dropbox-ubuntu-
server
Thank you!

Mais conteúdo relacionado

Último

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Último (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Destaque

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 

Destaque (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Do meetup

  • 1. Digital Ocean Meetup What I do with my $5 (per month actually)
  • 2. Introduction About me? Or about Digital Ocean?
  • 3. What I’m going to talk about
  • 8. Performance? • Sorry no picture. • Benchmarks gives some indication, but hard to make it really objective and useful. • Location. DO has no Asia servers.. yet.
  • 10. Experience with DO • I have a website: www.dilegno.sg • Some parts of Shoppink use Digital Ocean • Plus my random stuff I’m going to share with you
  • 13. One
  • 14. Two
  • 17. Recipe • A personal website. • Simply get a web server running (apache or nginx) • My website uses Sinatra. • We then need to get nginx talking to Sinatra.
  • 18. Sinatra • Sinatra is a Ruby micro-framework • require 'sinatra' get '/hi' do "Hello World!" end
  • 19. Unicorn # set path to app that will be used to configure unicorn, # note the trailing slash in this example @dir = "/home/sockmister/personal-website/" worker_processes 1 working_directory @dir timeout 30 # Specify path to socket unicorn listens to, # we will use this in our nginx.conf later listen "#{@dir}tmp/sockets/unicorn.sock", :backlog => 64 # Set process id path pid "#{@dir}tmp/pids/unicorn.pid" # Set log file paths stderr_path "#{@dir}log/unicorn.stderr.log" stdout_path "#{@dir}log/unicorn.stdout.log"
  • 20. Nginx • sudo apt-get install nginx • We can start, stop, restart by o sudo service nginx restart|start|stop|status • We then write the config files.
  • 21. The Idea • The apps we are running today run behind nginx. Nginx App1 App2 App3 Incoming Requests Outgoing Replies
  • 22. Config File upstream pohchiat{ server unix:/home/sockmister/personal-website/tmp/sockets/unicorn.sock; } server { listen 80; server_name www.pohchiat.com; root /home/sockmister/personal-website/public; location / { proxy_pass http://pohchiat; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
  • 23. Done!
  • 25. Recipe • Setup GitLab o Install dependencies o Setup new user o Clone and install GitLab shell o Setup database (postgresql or mysql) o Setup GitLab itself • Hook up with Nginx
  • 26. Dependencies • Python 2 o Sudo apt-get install python • Ruby o Ubuntu repositories are outdated o I use rvm to handle ruby versions. • Gem o gem install bundler
  • 27. Adduser • We need to create a new user called ‘git’. o sudo adduser --disabled-login --gecos 'GitLab' git
  • 28. GitLab Shell • Clone o sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git • Git checkout the right version o sudo -u git -H git checkout v1.7.1 • Edit config file o sudo -u git -H editor config.yml • Run a script o sudo -u git -H ./bin/install
  • 29. Database • Install postgresql o sudo apt-get install -y postgresql-9.1 libpq-dev • Login o sudo -u postgres psql -d template1 • Create user and database o CREATE USER git WITH PASSWORD '$password'; o CREATE DATABASE gitlabhq_production OWNER git;
  • 30. GitLab • Clone o sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab • Git checkout o sudo -u git -H git checkout 6-1-stable • Configure o Copy and change GitLab config file o Mkdir for logs, tmp, public o Copy and change unicorn config file • Install required Gems o gem install charlock_holmes --version '0.6.9.4' o bundle install --deployment --without development test mysql aws • Initialize DB o sudo -u git -H chmod o-rwx config/database.yml o bundle exec rake gitlab:setup RAILS_ENV=production • Run as service
  • 31. Nginx • This time GitLab has supplied the Nginx config file. • The idea though, is really the same.
  • 32. Done!
  • 34. Calibre Library This needs a bit of intro.
  • 36. Recipe • Setup calibre app (this time it’s actually really simple) • Setup dropbox daemon • Hook up to Nginx (same!)
  • 37. Setup Calibre • sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main() • To start calibre server, • Sudo /opt/calibre/calibre-server • Options: • --with-library • --username • --password • --daemonize
  • 38. Dropbox • I run calibre on my laptop as well. • Need a simple way to sync the books both ways. • Trivia: NUS won Dropbox space race a while ago and all NUS students have 25 GB extra space.
  • 39. Dropbox • Download & install o wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86 o tar –xzvf dropbox.tar.gz • Run o ~/.dropbox-dist/dropboxd • Link to your Dropbox account o This client is not linked to any account… • Control Dropbox o wget -O ~/.dropbox/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"
  • 40. Done!
  • 41. Caveats • It’s experimental. • Just because you can, doesn’t mean you should. • 512MB RAM • Erm. I cheated. I paid for domain too.
  • 42. Takeaway • Tons of open source projects to try out. • It’s not a must to run this on DO.
  • 43. Resources • Digital Ocean has a lot of guides. A lot a lot.
  • 44. Otherwise… • Setup nginx o http://ruby-journal.com/how-to-setup-rails-app-with-puma-and-nginx/ o http://recipes.sinatrarb.com/p/deployment/nginx_proxied_to_unicorn • GitLab o https://github.com/gitlabhq/gitlabhq/blob/6-1- stable/doc/install/installation.md • Calibre server o http://manual.calibre-ebook.com/cli/calibre-server.html • Dropbox daemon o http://ubuntuservergui.com/ubuntu-server-guide/install-dropbox-ubuntu- server

Notas do Editor

  1. So I noticed most people start their talk with an introduction. I’m going to do likewise.I’m not really sure if there’s much to intro about me, but I’m PohChiat.
  2. I realised that my title was really cryptic. I was kind of chatting with bryan about what I wanted to talk about. A couple of ideas, but I found out what I have really been doing was simply fooling around with what $5 could give me.So today, I’m going to share with you the kind of stuff I got running on my droplet at this moment. I certainly didn’t invent any of this stuff,