Skip to content

Commit 00d48ff

Browse files
authored
Merge pull request laradock#5 from LaraDock/master
Just update
2 parents 5210ca7 + fb049ef commit 00d48ff

18 files changed

Lines changed: 632 additions & 37 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.idea
12
/logs
23
/data
3-
.env
4+
.env

README.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
4949
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
5050
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
5151
- [Install xDebug](#Install-xDebug)
52+
- [Start/Stop xDebug](#Controll-xDebug)
53+
- [Production](#Production)
54+
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
5255
- [Misc](#Misc)
5356
- [Use custom Domain](#Use-custom-Domain)
5457
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
@@ -290,7 +293,7 @@ If you need a special support. Contact me, more details in the [Help & Questions
290293

291294

292295
<a name="Docker"></a>
293-
### [Docker]
296+
294297

295298

296299

@@ -472,7 +475,6 @@ docker logs {container-name}
472475

473476
<br>
474477
<a name="Laravel"></a>
475-
### [Laravel]
476478

477479

478480

@@ -701,7 +703,6 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins
701703

702704
<br>
703705
<a name="PHP"></a>
704-
### [PHP]
705706

706707

707708

@@ -833,10 +834,51 @@ It should be like this:
833834
2 - Re-build the containers `docker-compose build workspace php-fpm`
834835

835836

837+
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm).
838+
839+
840+
<br>
841+
<a name="Controll-xDebug"></a>
842+
### Start/Stop xDebug:
843+
844+
By installing xDebug, you are enabling it to run on startup by default.
845+
846+
To controll the behavior of xDebug (in the `php-fpm` Container), you can run the following commands from the LaraDock root folder:
847+
848+
- Stop xDebug from running by default: `./xdebugPhpFpm stop`.
849+
- Start xDebug by default: `./xdebugPhpFpm start`.
850+
- See the status: `./xdebugPhpFpm status`.
851+
852+
853+
854+
855+
856+
<br>
857+
<a name="Production"></a>
858+
859+
860+
861+
862+
<br>
863+
<a name="Digital-Ocean"></a>
864+
### Setup Laravel and Docker on Digital Ocean
865+
866+
####[Full Giude Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
867+
868+
869+
870+
871+
872+
873+
874+
875+
836876

837877
<br>
838878
<a name="Misc"></a>
839-
### [Misc]
879+
880+
881+
840882

841883

842884
<br>
@@ -960,6 +1002,8 @@ Make sure the ports for the services that you are trying to run (80, 3306, etc.)
9601002

9611003

9621004

1005+
1006+
9631007
<br>
9641008
<a name="upgrading-laradock"></a>
9651009
### Upgrading LaraDock
@@ -987,7 +1031,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ
9871031

9881032
This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else.. Do not hesitate to contribute, you are more than welcome :)
9891033

990-
#### Read our [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md)
1034+
#### Read our [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/_guides/contributing.md)
9911035

9921036
<a name="Help"></a>
9931037
## Help & Questions
@@ -1006,6 +1050,8 @@ For special help with Docker and/or Laravel, you can schedule a live call with t
10061050

10071051
**Main Contributors:**
10081052

1053+
- [MidasCodeBreaker](https://github.com/midascodebreaker)
1054+
- [Larry Eitel (LarryEitel)](https://github.com/LarryEitel)
10091055
- [Suteepat (tianissimo)](https://github.com/tianissimo)
10101056
- [David (davidavz)](https://github.com/davidavz)
10111057
- [Lialosiu](https://github.com/lialosiu)

CONTRIBUTING.md renamed to _guides/contributing.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
# Contributing to LaraDock
42

53
Your contribution is more than welcome. Let's keep LaraDock amazing.
@@ -54,9 +52,21 @@ Help us to maximize the effort we can spend fixing issues and adding new
5452
features, by not reporting duplicate issues.
5553

5654

55+
### Before Submitting a Pull Request (PR)
56+
57+
Always Test everything and make sure its working:
58+
59+
- Pull the latest updates (or fork of you don’t have permission)
60+
- Before editing anything:
61+
- Test building the container (docker-compose build --no-cache container-name) build with no cache first.
62+
- Test running the container with some other containers in real app and see of everything is working fine.
63+
- Now edit the container (edit section by section and test rebuilding the container after every edited section)
64+
- Testing building the container (docker-compose build container-name) with no errors.
65+
- Test it in real App.
66+
5767

58-
### Submitting a Pull Request (PR)
59-
Before you submit your pull request consider the following guidelines:
68+
### Submitting a PR
69+
Consider the following guidelines:
6070

6171
* Search [GitHub](https://github.com/LaraDock/laradock/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort.
6272

@@ -93,7 +103,7 @@ git push origin my-fix-branch -f
93103

94104

95105

96-
### After your pull request is merged
106+
### After your PR is merged
97107

98108
After your pull request is merged, you can safely delete your branch and pull the changes
99109
from the main (upstream) repository:
@@ -127,4 +137,4 @@ from the main (upstream) repository:
127137

128138

129139
<br>
130-
### Happy Coding :)
140+
### Happy Coding :)

_guides/digital_ocean.md

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
#### Install Docker
2+
```
3+
Login Digital Ocean
4+
Add Droplet
5+
1 Click Install docker
6+
Choose Droplet
7+
reset ROOT password
8+
check email
9+
```
10+
11+
#### SSH to your Server
12+
13+
```
14+
ssh root@ipaddress
15+
```
16+
you will be prompt of that password.
17+
type the password you receive in your email
18+
19+
then it will ask to you to change a new password
20+
just change it to the custom root password you want
21+
22+
After SSH
23+
you can check that docker command is working by typing
24+
25+
```
26+
$root@midascode:~# docker
27+
```
28+
29+
#### Set Up Your Laravel Project
30+
31+
```
32+
$root@midascode:~# apt-get install git
33+
$root@midascode:~# git clone https://github.com/laravel/laravel
34+
$root@midascode:~# cd laravel
35+
$root@midascode:~/laravel# git checkout develop
36+
$root@midascode:~/laravel/ git submodule add https://github.com/LaraDock/laradock.git
37+
$root@midascode:~/laravel/ cd laradock
38+
```
39+
40+
#### Install docker-compose command
41+
42+
```
43+
$root@midascode:~/laravel/laradock# curl -L https://github.com/docker/compose/releases/download/1.8.0/run.sh > /usr/local/bin/docker-compose
44+
$root@midascode:~/chmod +x /usr/local/bin/docker-compose
45+
```
46+
47+
#### Create Your LaraDock Containers
48+
49+
```
50+
$root@midascode:~/laravel/laradock# docker-compose up -d nginx mysql
51+
```
52+
53+
#### Go to Your Workspace
54+
55+
```
56+
docker-compose exec workspace bash
57+
```
58+
59+
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
60+
61+
```
62+
$ root@0e77851d27d3:/var/www/laravel# composer install
63+
$ root@0e77851d27d3:/var/www/laravel# cp .env.example .env
64+
$ root@0e77851d27d3:/var/www/laravel# php artisan key:generate
65+
$ root@0e77851d27d3:/var/www/laravel# exit
66+
$root@midascode:~/laravel/laradock# cd ..
67+
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
68+
```
69+
70+
you can then view your laravel site at your ipaddress
71+
for example
72+
```
73+
192.168.1.1
74+
```
75+
76+
You will see there Laravel Default Welcome Page
77+
78+
but if you need to view on your custom domain name
79+
which you would.
80+
81+
#### Using Your Own Domain Name
82+
login to your DNS provider
83+
Godaddy, Namecheap what ever...
84+
And Point the Custom Domain Name Server to
85+
86+
```
87+
ns1.digitalocean.com
88+
ns2.digitalocean.com
89+
ns3.digitalocean.com
90+
```
91+
In Your Digital Ocean Account go to
92+
```
93+
https://cloud.digitalocean.com/networking/domains
94+
```
95+
add your domain name and choose the server ip you provision earlier
96+
97+
#### Serve Site With NGINX (HTTP ONLY)
98+
Go back to command line
99+
```
100+
$root@midascode:~/laravel/laradock# cd nginx
101+
$root@midascode:~/laravel/laradock/nginx# vim laravel.conf
102+
```
103+
remove default_server
104+
```
105+
106+
listen 80 default_server;
107+
listen [::]:80 default_server ipv6only=on;
108+
109+
```
110+
and add server_name (your custom domain)
111+
```
112+
listen 80;
113+
listen [::]:80 ipv6only=on;
114+
server_name yourdomain.com;
115+
```
116+
117+
#### Rebuild Your Nginx
118+
```
119+
$root@midascode:~/laravel/laradock/nginx# docker-compose down
120+
$root@midascode:~/laravel/laradock/nginx# docker-compose build nginx
121+
```
122+
123+
#### Re Run Your Containers MYSQL and NGINX
124+
```
125+
$root@midascode:~/laravel/laradock/nginx# docker-compose up -d nginx mysql
126+
```
127+
128+
###### View Your Site with HTTP ONLY (http://yourdomain.com)
129+
130+
#### Run Site on SSL with Let's Encrypt Certificate
131+
132+
###### Note: You need to Use Caddy here Instead of Nginx
133+
134+
###### To go Caddy Folders and Edit CaddyFile
135+
136+
```
137+
$root@midascode:~/laravel/laradock# cd caddy
138+
$root@midascode:~/laravel/laradock/caddy# vim Caddyfile
139+
```
140+
141+
Remove 0.0.0.0:80
142+
143+
```
144+
0.0.0.0:80
145+
root /var/www/laravel/public
146+
```
147+
and replace with your https://yourdomain.com
148+
149+
```
150+
https://yourdomain.com
151+
root /var/www/laravel/public
152+
```
153+
uncomment tls
154+
155+
```
156+
#tls self-signed
157+
```
158+
and replace self-signed with your email address
159+
160+
```
161+
tls midascodebreaker@gmai.com
162+
```
163+
This is needed Prior to Creating Let's Encypt
164+
165+
#### Run Your Caddy Container without the -d flag and Generate SSL with Let's Encrypt
166+
167+
```
168+
$root@midascode:~/laravel/laradock/caddy# docker-compose up caddy
169+
```
170+
171+
you will be prompt here to enter your email... you may enter it or not
172+
```
173+
Attaching to laradock_mysql_1, laradock_caddy_1
174+
caddy_1 | Activating privacy features...
175+
caddy_1 | Your sites will be served over HTTPS automatically using Let's Encrypt.
176+
caddy_1 | By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
177+
caddy_1 | https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf
178+
caddy_1 | Activating privacy features... done.
179+
caddy_1 | https://yourdomain.com
180+
caddy_1 | http://yourdomain.com
181+
```
182+
183+
After it finish Press Ctrl + C to exit ...
184+
185+
#### Stop All Containers and ReRun Caddy and Other Containers on Background
186+
187+
```
188+
$root@midascode:~/laravel/laradock/caddy# docker-compose down
189+
$root@midascode:~/laravel/laradock/caddy# docker-compose up -d mysql caddy
190+
```
191+
View your Site in the Browser Securely Using HTTPS (https://yourdomain.com)
192+
193+
##### Note that Certificate will be Automatically Renew By Caddy
194+
195+
>References:
196+
>
197+
- [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04)
198+
- [https://www.digitalocean.com/products/one-click-apps/docker/](https://www.digitalocean.com/products/one-click-apps/docker/)
199+
- [https://docs.docker.com/engine/installation/linux/ubuntulinux/](https://docs.docker.com/engine/installation/linux/ubuntulinux/)
200+
- [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
201+
- [https://caddyserver.com/docs/automatic-https](https://caddyserver.com/docs/automatic-https)
202+
- [https://caddyserver.com/docs/tls](https://caddyserver.com/docs/tls)
203+
- [https://caddyserver.com/docs/caddyfile](https://caddyserver.com/docs/caddyfile)
204+
205+
206+
207+
208+
209+
210+
211+
212+
213+
214+

0 commit comments

Comments
 (0)