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 ....
- Create New Account In Digital Ocean get FREE 10$ Credit :)
-
Digital Ocean Create a New Droplet
-
Click 1 Click Install Tab
-
Find And choose Docker Image
-
Choose Size Preferabbly choose 20$ /mo
NOTE : At Least 2 GB memory to avoid, shutting down of containers unexpectedly due to lack of memory
- 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
SSH to your MinttyWSL Terminal
- SSH to terminal
ssh root@ipaddress
- We Create a new Zsh Sudo User
adduser username
usermod -aG sudo username
- Switch User
su - username
- Install ZSH
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
- Use Your Own ZSH Config , you can use mine or edit it
wget https://gist.githubusercontent.com/codeitlikemiley/68d3f1a9a1da5abf2c8152d7612b943a/raw/ff85fabf5d17f86984e5a58ec2fb5a089276ff65/production.zshrc
mv production.zshrc .zshrc
Added Shortcut: me (your home), lara (laradock folder), sites (/var/www), code(/var/www/code) for your App
- We Add Bash Profile @ $HOME Directory
wget https://gist.githubusercontent.com/codeitlikemiley/68d3f1a9a1da5abf2c8152d7612b943a/raw/bf170527c611609d98fdbcd24540f8cb28e2ad88/production.bashprofile
mv production.bashprofile .bash_profile
- Install Oh-My-Zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
- Add Our Custom Theme For Our Terminal To Look Awesome!
exit
su - username
cd $ZSH/themes
wget https://raw.githubusercontent.com/codeitlikemiley/materialshell/1.1.0/zsh/other/materialshell-electro.zsh-theme
- 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
- Copy Plugins Configuration of Vim
cd .vim
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/53d4a83dc262cdc2d7b7dadeab72a46666538222/plugins.vim
- Add Windows Short Cut Keys To Work With Vim
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/53d4a83dc262cdc2d7b7dadeab72a46666538222/mswin.vim
source ~/.vim/mswin.vim
- Install Vim Dependencies ( This is For Search )
cd ~
sudo apt-get install exuberant-ctags
sudo apt-get install ack-grep
- Install All Vim Plugins
vim
,ep
:PluginInstall
:q
- Add ackrc config @ $HOME/.ackrc
wget https://gist.githubusercontent.com/g0ld3lux/db5c2aa472d7815728a6990abc599df2/raw/db22e9029c28224b6bc287698030ff89697c8ad2/user.ackrc
mv user.ackrc .ackrc
- go back to the root user
exit or su - root
- Install docker compose
docker-compose
- switch user
su - su username
- Run Docker on Sudo on Current User
sudo gpasswd -a $USER docker
- Allow docker-compose to be use on non-root user
sudo chown -R $(whoami) /usr/local/bin
Note , if you didnt install from 1 click install app and havent choose docker , you may need to configure this yourself
- Clone Laradock
cd /var
sudo mkdir www
cd www
sudo chown -R $USER:$USER .
git clone https://github.com/laradock/laradock
- Configure your Laradock Config
cd laradock
cp env-example .env
vim .env
- Configure MYSQL database , user, user pass and root pass
/MYSL
enter
press N for next and Enter if you Find MYSQL Configuration
MYSQL_VERSION=8.0
MYSQL_DATABASE=db
MYSQL_USER=YOURUSERNAME
MYSQL_PASSWORD=YOURPASSWORD
MYSQL_ROOT_PASSWORD=YOURROOTPASS
-
exit type :wq
-
Configure Your Web server (NGINX)
cd nginx/sites
cp laravel.conf.example code.conf
- Edit Your Nginx Conf and ADD your DOMAIN
vim code.conf
server_name YOURDOMAINNAME.com;
root /var/www/code/public;
- Clone Your APP REPO
sites
git clone YOURLARAVELPROJECT code
- Run docker-compose command to spin up your app server requirement for example redis, nginx , mysql
docker-compose up -d nginx redis mysql phpmyadmin
- Install All Your App Composer Dependecies
ws
cd code
composer install
php artisan key:generate
- Configure Your App Env File
cp .env.example .env
vim .env
- You Need to Change Redis and Mysql HOST and your DB credentials
DB_HOST=mysql
DB_DATABASE=db
DB_USERNAME=YOURUSERNAME
DB_PASSWORD=YOURPASSWORD
REDIS_HOST=redis
Note: mysql and redis is being autoproxy by docker to point to correct address, same with other containers
- you can then view your laravel site at your ipaddress and Once your DNS propagate you can visit your domain also
192.168.1.1
-
You need to Login in your Digital Ocean Account
-
Go to NETWORKING
-
Then Add your Domain Name
-
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!
note in cases where mysql cant be launch... you need to change your laradock .env file for the data of mysql
if leave unconfigure it will be run on /root/.laradock/data
which if you are running a none root user will make an error for required permission.
to fix that , you need to either change the location of your .laradock/data to ../.laradock/data
at your first try this will create an error but, after that we will need to chown that
go to the root of your laradock websites then do
sudo chown -R $(whoami) /.laradock