#03 💻 Membuat Project Laravel Baru menggunakan Docker Container
Summary
TLDRThis video tutorial guides viewers on developing a web-based application using Laravel, a popular PHP framework. It covers setting up a Docker container with a pre-configured Laravel environment provided by DPT. The script explains creating a new project, configuring 'docker-compose.yml', mapping directories, and setting environment variables for virtual hosting and SSL certificates. It also demonstrates accessing the application locally, troubleshooting permissions, and ensuring the application runs smoothly, providing a comprehensive guide for beginners in Laravel web development.
Takeaways
- 😀 The video is a tutorial on how to develop a web-based application using files and containers provided by DPT.
- 🔧 The tutorial uses a Docker image for Laravel web development, which is shared and available on docker.com.
- 💾 The video covers the setup of a new project with necessary files for a Laravel application, including a docker-compose file.
- 📁 It explains the process of defining services in a docker-compose file, including the web development container named 'laravel.dev-example-web'.
- 🖥️ The tutorial mentions the need for a PHP version of at least 7.4 for Laravel 8, which is supported by the provided Docker image.
- 🔄 The video shows how to map the 'src' directory to the 'www' directory within the Laravel web development container.
- 🌐 It discusses the importance of setting environment variables for the virtual host, virtual port, and SSL certificate.
- 📡 The tutorial includes instructions for configuring DNS settings and networks for the Laravel application container.
- 🚀 The video demonstrates how to execute the 'docker-compose up' command to start the Laravel application container.
- 🔍 It shows troubleshooting steps, such as fixing permissions issues and setting the correct ownership for directories.
- 🛠️ The tutorial ends with accessing the Laravel application, making necessary configurations, and resolving permission denied errors.
Q & A
What is the main topic of the video?
-The video is about explaining how to create and develop an informant to build a web-based application using files and running it on a Laravel web.dev container.
What is the provided docker image used for in the video?
-The provided docker image is used for Laravel web development and it is shared and possibly hacked from docker.com.
Which PHP versions are supported by the Laravel web.dev image?
-The Laravel web.dev image supports PHP versions starting from 7.3 up to 8.
What is the first step in setting up the project according to the video?
-The first step is to ensure that Docker Desktop is running and the service engineers proxy is also running.
How should the project be named and where should it be placed?
-The project should be named 'laravel-example' and it should be placed inside a folder named 'GTA'.
What is the purpose of the 'docker-compose.yml' file created in the video?
-The 'docker-compose.yml' file is used to define and run the container for the Laravel web development environment.
What is the name of the service defined in the 'docker-compose.yml' file?
-The service is named 'laravel.dev-example-web'.
What is the image used for the 'laravel.dev-example-web' service in the 'docker-compose.yml' file?
-The image used is 'dpt/laravel.dev:sweep', which is provided by DPT.
What environment variables need to be defined in the 'docker-compose.yml' file for virtualhost and SSL?
-The environment variables needed are 'VIRTUAL_HOST', 'VIRTUAL_PORT', 'SELF_SIGN_HOST', and 'VIRTUAL_PROTO'.
How can you access the Laravel application after setting up the container?
-You can access the Laravel application by using the domain 'laravel.dev-example.com' after setting up the virtualhost and SSL certificate.
What command is used to start the services defined in the 'docker-compose.yml' file?
-The command used to start the services is 'docker-compose up'.
What error occurred during the execution of 'docker-compose up' and how was it fixed?
-An error occurred due to incorrect volume mapping which was fixed by correcting the volume directive from 'dot src.id' to 'volumes'.
How do you access the Laravel container after it's running?
-You can access the Laravel container by executing the command 'docker exec -it [container_name] /bin/bash'.
What command is used to install Laravel project dependencies after entering the container?
-The command used to install Laravel project dependencies is 'composer install'.
What issue was encountered with file permissions and how was it resolved?
-A 'Permission Denied' error for the 'storage' directory was encountered, which was resolved by changing the ownership to 'www-data:nobody'.
Outlines
🛠️ Setting Up Laravel Web Development Environment
This paragraph outlines the process of setting up a web development environment using Laravel, a popular PHP framework. It starts by mentioning the availability of a Docker image for Laravel provided by the DPT, which includes support for PHP versions 7.3 to 8.0 and pre-installed libraries. The speaker instructs viewers to ensure Docker is running on their desktop and to navigate to a specific directory to create a new project named 'laravel-example'. The project will contain configuration files for Docker, managed through a 'docker-compose.yml' file. The setup involves defining services, mapping directories, and setting environment variables for virtual hosting and SSL certificates, all within the context of using Docker for local development.
🔧 Configuring Docker Compose and Networking
The second paragraph delves into the configuration of Docker Compose, focusing on the services required to run the Laravel web development container. It explains the need to connect the Laravel container to the same network used by a DNS proxy, ensuring seamless integration. The speaker also discusses the importance of setting the correct DNS for internet connectivity and the process of defining environment variables for the virtual host, virtual port, and SSL certificate. The paragraph includes troubleshooting steps, such as correcting volume definitions and ensuring the proper execution of 'docker-compose up' to start the container. It concludes with the verification of the container's successful setup and the initial access to the Laravel application.
🚀 Accessing and Configuring the Laravel Project
In this paragraph, the speaker demonstrates how to access and configure the Laravel project within the Docker container. After entering the container using a terminal command, the speaker shows the process of downloading and setting up a new Laravel project using Composer. The paragraph highlights the importance of permissions, as files downloaded within the container need to be accessible by the correct user and group, which in this case are 'nobody:nobody'. The speaker also addresses a 'permission denied' error for the 'storage' directory and resolves it by changing the ownership to 'nobody:nobody'. The paragraph concludes with the successful access and configuration of the Laravel application, ready for further development.
Mindmap
Keywords
💡Docker
💡Laravel
💡Docker Image
💡Docker Compose
💡PHP
💡Virtual Host
💡SSL Certificate
💡Environment Variables
💡Composer
💡Permissions
💡Volumes
Highlights
The video explains how to develop an informant for building a web-based application using Laravel web.dev containers.
It mentions that the Docker image for Laravel web.dev is pre-configured with several PHP versions and libraries.
Ensures that Docker Desktop and the Engineers Proxy service are running before starting the project setup.
Guides on creating a new project directory and setting up the necessary files for the Laravel application.
Instructs on using Visual Studio Code to create a docker-compose.yml file for running Laravel containers.
Details defining the version of the docker-compose file and setting up services within it.
Explains the process of mapping the source directory to the Laravel web development container.
Discusses setting environment variables for the virtual host and SSL certificate within the docker-compose file.
Covers the configuration of DNS settings and networks for the Laravel application.
Demonstrates the execution of the docker-compose up command to start the Laravel container.
Mentions the potential need to download the Laravel image if it hasn't been done before.
Guides on accessing the Laravel application using a local domain after setting up the virtual host.
Explains how to enter the Laravel container using Docker commands to interact with the application.
Shows the process of initializing a new Laravel project using Composer within the container.
Addresses potential permission issues when accessing the storage directory of the Laravel application.
Provides a solution to change ownership of the storage directory to the correct user for proper access.
Concludes by summarizing the steps to create and run a new Laravel project within a Docker container.
Transcripts
Indonesia pada video kali ini saya akan
menjelaskan Bagaimana cara membuat
develop an informant untuk membangun
atau mengembangkan sebuah aplikasi
berbasis web menggunakan file-file dan
dijalankan diatas kontainer laravel
web.dev yang telah disediakan oleh DPT
si Ade edisi ini yang tampil di layar
adalah docker image yang sudah di-share
di-hack docker.com dimana laravel.dev
ini bisa digunakan untuk laravel
beberapa versi tidaknya 89 ya karena
yang PHP yang disupport adalah mulai PHP
7374 sampai ke-8 dan sudah ada beberapa
library Disini yang sudah diinstall baik
untuk memulai pertama pastikan dokter
desktop sudah berjalan dan service
engineers proxy juga sudah berjalan
seperti ini kemudian
ia pindah ke wesel kita dan masuk ke
folder atau direktori kita disini kita
akan membuat sebuah Project baru yang
nanti di dalamnya akan ada file-file
dari pramugara file dan juga file
docker-compose yang digunakan untuk
menjalankan kontainer dari laravel
web.dev ini nah Project yang kita akan
buat adalah Project dengan nama laravel
example yang akan diletakkan di dalam
folder GTA kita masuk ke sini dan kita
buat super directory SRT yang akan
menampung file-file dari laravel di
folder src ini source Nah kita akan
menggunakan fisik bantuan Visual Studio
code untuk membuat file dokter kompos
Hai nah disini sudah muncul Visual
Studio code yang membuka folder level
example yang di sini sudah ada folder
src Nah kita akan membuat file
docker-compose.yml Dirut direktorinya
new file disini kita beri nama dokter
Des kompos.me nah yang pertama kita bisa
lakukan adalah pertama mendefinisikan
versi dari Yaumul file-nya versi dari m
avail.com posnya kemudian mendefinisikan
Disini versi 3 kemudian kita
mendefinisikan Services apa saja akan
dijalankan oleh dokter kompos ini yang
pertama tentu kita perlu membuat
kontainer web development nya kita beri
nama laravel.dev example Dash web dengan
detail pertama kontennya kita beri nama
sama dengan nama servicenya
Hai laravel This example the Sweep
kemudian imagenya nah ini saya ini kita
menggunakan sudah diberikan oleh DPT
yaitu DPT z-slash laravel.dev Sweep Eh
iya de Sweep destef versinya kita pakai
8.0 karena kita menggunakan level 8
sehingga butuh PHP versi minimal 74 ya
tapi kita pakai inversi 80 kemudian
folder source kita yang ada di sini ini
akan berisi file-file penduduk file-file
dari level ini akan kita house jadi
akan kita harus kita Mohon ke dalam
kontainer ya jadi dot src.id berarti
karena directory masuk ke direktori SFC
kita mapping kan dengan flash www.ml
jadi laravel web.dev ini menghusus
search directory
di Project laravel kita disrespects
lewes html Kemudian untuk kepentingan
virtualhost dan selesaiin SSL
certificate kita perlu mempassing
environment variable yang pertama adalah
virtualhost ini adalah berisi nanti
aplikasi laravel-excel kita ini akan
diakses melalui virtual sapa atau domain
nya apa gitu ya Nah ini kita Devil's aja
nanti pakaiin file kita definisikan
variabel Inv environment variable
seperti ini kemudian Selain virtualhost
Kita perlu juga mendefinisikan virtual
keyboard virtual port Kemudian untuk SSL
certificate ya kita definisikan variabel
self sign house
sel-sel house kemudian terkadang
kita tidak bisa terkoneksi dengan domain
alamat tertentu di internet Nah kita
setting sekalian disini DNS nya disini
kebetulan menggunakan DNS it's nah er
dan semua bebas menggunakan DNS yang
lain sebenarnya kemudian networks di
sini nanti laravel in simple web ini
akan terkoneksi dengan Network yang sama
dengan Network yang dijalankan oleh DNS
proxy Jadi kita pakai nothing sedih buat
sebelumnya itu ndx proxy Network
kelebihan es sini nah kita
jika networknya networknya ini adalah
engine.exe proxy Network gimana karena
sudah didefinisikan sebelumnya di luar
dari docker-compose ini maka kita tulis
dia sebagai external true Oke kita cek
terlebih dahulu docker-compose kita
sudah jadi pertama versi 3 service esnya
ada laravel-excel web dengan nama
kontainer yang refleks sample web
menggunakan image laravel web develop
and titik nol memetingkan volume src ke
Farewell html dan ini informal
variabelnya dan Ini setting DNS dan Ini
setting network nya oke karena ini kita
masih punya tanggungan variabel disini
kita buat infonya ya
Hai Jadi yang pertama adalah virtual
host kita akan memberikan domain
laravel.dev example.com call virtual
port nya karena default dari level web
content adalah pembuluh kemudian self
sign house in juga sama yang akan
dijerat kan SSL certificate adalah
domain laravel example.com call kefir
Town House virtual port selesaiin house
keep virtualhost without science is
sudah sesuai SFC masih kosong nanti kita
akan populer setelah kontainer nya jadi
kita akan masuk ke kontainer nya dan
menguat Project laravel ya Oke kita
kembali ke websitenya disini sudah ada
docker-compose.yml yang dibuat dari bisa
video call sekarang kita eksekusi
menggunakan
dan kan dengan menggunakan perintah
docker-compose up minde Oh maaf ada
kesalahan di sini seharusnya volumes ya
saya kurang sini oke nah kalau pertama
Kak mungkin kalau rekan-rekan pertama
kali melakukan docker-compose
menggunakan image ini maka nanti akan
ada proses pengunduhan the crimes lebih
dahulu karena ini saya sudah pernah maka
dia langsung terkait seperti ini kita
lihat di dokter besok sudah ada laravel
example kontainer laravel smpe berjalan
Bagaimana cara mengaksesnya kita pakai
laravel.com lokal tetapi ini masih
domainnya belum ada kita setting dulu
disini menggunakan house
nah ini kita tambahkan saja disini Pasti
karena saat ini Creator ya kan eh IP
private kita dengan domain yang
digunakan untuk virtualhost yaitu
laravel example.com call-time Pinkan
dengan IP private bisa 127001 atau
menggunakan epifat nah ini ada perbedaan
sebenarnya ketika kita misalnya
membutuhkan Kernel ke diri sendiri maka
ini saya menggunakan Adobe Premiere saja
168 109 kita at kita save ya laravel.dev
example.com kita coba tes di sini ping
laravel.com example.com sudah terkoneksi
kita coba akses menggunakan Google
Chrome
Hai laravel example.com ini masih nonton
ya oke karena seharusnya belum ada nah
sekarang kita masuk ke kontainernya
menggunakan perintah dokter excek mint
interaktif Terminal Mini temin sebagai
root user Clara m kontainernya laravel
example web dengan mengeksekusi bindes
SH ya Oke kita sudah masuk dan kita
lihat di sini masih kosong belum ada
project laravel nya kita terlihat
menggunakan perintah composer kriyep
Dash Project laravel yang terbaru ya di
karena directory kini proses pengunduhan
Project laravel nya bisa kita lihat di
sini composer sedang melakukan
pengunduhan laravel
ini definisi dependensi yang dibutuhkan
Jika pernah mengunduh mungkin akan lebih
jauh lebih cepat daripada proses ini key
sambil menunggu kita lihat di sini nanti
setelah Project yang terkait seperti ini
ke ini juga kakinya juga dibuat Oke kita
lihat di sini nah ini sudah apa namanya
tergenerate nah ini kita coba akses Nah
sudah berhasil aplikasi rela file-nya
sudah bisa berjalan sehingga kalau kita
lihat disini kita bisa setting beberapa
Disini di RCTI mv-nya kita ganti menjadi
laravel example.com
porno
di Indonesia jika teman-teman menemukan
file to save Doddie MV One baterai
berarti kita ada permission yang perlu
kita perbaiki Kenapa karena disini kita
lihat di sini eh karena kita tadi masuk
sebagai root sehingga eh ketika kita
melakukan pengunduhan itu mengunduh
seluruh apa file owner sipnya masuk
kerut diset kepada rute ini kita bisa
pakai Kwon Min er kita set ke
Hai Oh maaf karena sudah sudo ya ya di
sini kita lihat kita sudah bisa mengedit
mulai sini kita refresh tetapi ada error
di sini permission Denied untuk storage
nah yang Sturridge perlu kita kasih eh
ownership khusus ke nobody nobody
the lounge
Hai storage kita cek
the story flash Ya sudah bisa berjalan
Oke jadi pada tutorial kali ini
rekan-rekan sudah bisa membuat file
membuat Project baru eh berbasis laravel
dan dijalankan menggunakan laravel
5.0 / 5 (0 votes)