Skip to content

Instantly share code, notes, and snippets.

@g0ld3lux
Last active April 23, 2019 16:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save g0ld3lux/4145d031bccf66404dcdb78e9c30dc11 to your computer and use it in GitHub Desktop.
Save g0ld3lux/4145d031bccf66404dcdb78e9c30dc11 to your computer and use it in GitHub Desktop.
ZSH + Vim Production in Digital Ocean - Running With Docker

Note: change all instance of my name with yours... :)

Requirement: Windows 10 Windows WSL WSL Mintty Digital Ocean Account

Note if you are not using windows, you dont need the vim config for windows ....

Digital Ocean Create a New Droplet

1 Click Install

choose Docker 17.05.0.-ce on 16.04

Choose Size Preferabbly choose 20$ /mo

add new ssh key

ssh-keygen -t rsa -C "your_email@example.com"

Just Follow Steps to get Key

Then Copy your SSH key

cat ~/.ssh/id_rsa.pub

Paste it on Your DO Droplet SSHKEY

Lastly Choose a hostname or let the default be set by DO

We Need to SSH in our Acccount using our WSL Terminal

ssh root@ipaddress

Assuming you are Root user

We Create a new Zsh Sudo User

adduser username
usermod -aG sudo username
su - username
sudo apt-get install zsh

make Zsh default for this user , temporary

chsh -s /bin/zsh

We edit our .bashrc

vim .bashrc

make zsh default , permanent

if [ -t 1 ]; then
exec zsh
fi

We Add Our Zshrc File @ $HOME Directory

wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/53d4a83dc262cdc2d7b7dadeab72a46666538222/production.zshrc
mv production.zshrc .zshrc

We Add Bash Profile @ $HOME Directory

wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/3279677826b2a6db48c852514f07eb5a94afc135/production.bashprofile
mv production.bashprofile .bash_profile

Note: You need to Change Line 3

vim .bash_profile
alias uriah = 'cd /home/uriah'

Line 12 and

alias uriah = 'cd /home/uriah'

Line 14

alias code = 'cd /var/www/SITENAME

Install Oh-My-Zsh

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

Add Our Custom Theme

cd $ZSH/themes
wget https://raw.githubusercontent.com/carloscuesta/materialshell/master/zsh/other/materialshell-electro.zsh-theme
mv materialshell-electro.zsh-theme materialshellelectro.zsh-theme

Configure Our Vim

add your .vimrc file at $HOME directory

cd ~
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/db22e9029c28224b6bc287698030ff89697c8ad2/user.vimrc
mv user.vimrc .vimrc

create .vim folder at $HOME directory

mkdir .vim

Get Vundle to Handle Our Vim Plugins

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

then add this 2 file inside .vim folder

cd .vim
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/53d4a83dc262cdc2d7b7dadeab72a46666538222/mswin.vim
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/53d4a83dc262cdc2d7b7dadeab72a46666538222/plugins.vim

Note: if your not Windows You dont Need mswin.vim uncomment this at your .vimrc

source ~/.vim/mswin.vim

Add Our Vim PLugins Dependencies

cd ~
sudo apt-get install exuberant-ctags
sudo apt-get install ack-grep

Install All Vim Plugins

vim
,ep
:PluginInstall

Add ackrc config @ $HOME/.ackrc

wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/db22e9029c28224b6bc287698030ff89697c8ad2/user.ackrc
mv user.ackrc .ackrc

Install Docker-Compose Commands Since 1 Click Install is Update it is easy as this command to download docker-compose

sudo docker-compose

We need to Create then Our App Directory

cd /var
sudo mkdir www
cd www
sudo chown -R $USER:$USER .
git clone laravelAppGithubRepo desiredFolderName
cd desiredFolderName
git submodule add https://github.com/Laradock/laradock.git

Configure your Laradock Config

cd laradock
vim .env
cd nginx
cd sites
cp project-1.conf.example yoursitename.conf

Edit Your Nginx Conf

vim yoursitename.conf

your nginx conf

 server_name yoursitename.com;
 root /var/www/yoursitename/public;

Run Docker on Sudo on Current User

sudo gpasswd -a $USER docker

Run docker-compose command to spin up your app server requirement for example redis, nginx , mysql

docker-compose up -d nginx redis mysql

you can then view your laravel site at your ipaddress for example

192.168.1.1 

If you Want to Configure it to Be Viewed on Your Bought Domain name

You need to Login in your Digital Ocean Account

Go to NETWORKING https://cloud.digitalocean.com/networking/domains

Then Add your Domain Name

example.com

Also You Need to Login In Your Domain Name Server Provider

For Example Godaddy

You Then Need to POint Your Domain to Digital Ocean DNS

ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

Thats It! Have Fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment