blackbirdchess-docker-dev/docs/getting-started/index.xml
2017-04-21 10:13:53 +12:00

222 lines
11 KiB
XML

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Getting-starteds on Laradock</title>
<link>http://laradock.io/getting-started/index.xml</link>
<description>Recent content in Getting-starteds on Laradock</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="http://laradock.io/getting-started/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Getting Started</title>
<link>http://laradock.io/getting-started/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://laradock.io/getting-started/</guid>
<description>
&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://git-scm.com/downloads&#34;&gt;Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.docker.com/products/docker/&#34;&gt;Docker&lt;/a&gt; &lt;code&gt;&amp;gt;= 1.12&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;p&gt;Choose the setup the best suits your needs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#A&#34;&gt;A) Setup for Single Project&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#A1&#34;&gt;A.1) Already have a PHP project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#A2&#34;&gt;A.2) Don&amp;rsquo;t have a PHP project yet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#B&#34;&gt;B) Setup for Multiple Projects&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name=&#34;A&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;a-setup-for-single-project&#34;&gt;A) Setup for Single Project&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;(Follow these steps if you want a separate Docker environment for each project)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a name=&#34;A1&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;a-1-already-have-a-php-project&#34;&gt;A.1) Already have a PHP project:&lt;/h3&gt;
&lt;p&gt;1 - Clone laradock on your project root directory:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git submodule add https://github.com/Laradock/laradock.git
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you are not using Git yet for your project, you can use &lt;code&gt;git clone&lt;/code&gt; instead of &lt;code&gt;git submodule&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Note 2: To keep track of your Laradock changes, between your projects and also keep Laradock updated. &lt;a href=&#34;http://laradock.io/documentation/#keep-track-of-your-laradock-changes&#34;&gt;Check this&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;+ project-a
+ laradock-a
+ project-b
+ laradock-b
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(It&amp;rsquo;s important to rename the folders differently in each project.)&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a name=&#34;A2&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;a-2-don-t-have-a-php-project-yet&#34;&gt;A.2) Don&amp;rsquo;t have a PHP project yet:&lt;/h3&gt;
&lt;p&gt;1 - Clone this repository anywhere on your machine:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone https://github.com/laradock/laradock.git
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;+ laradock
+ project-z
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;2 - Edit your web server sites configuration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In case of NGINX:&lt;/strong&gt; open &lt;code&gt;nginx/sites/default.conf&lt;/code&gt; and change the &lt;code&gt;root&lt;/code&gt; from &lt;code&gt;/var/www/public&lt;/code&gt; to &lt;code&gt;/var/www/{my-project-folder-name}/public&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Or you can keep &lt;code&gt;default.conf&lt;/code&gt; as it is, and create a separate config &lt;code&gt;my-site.conf&lt;/code&gt; file for it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In case of Apache:&lt;/strong&gt; :P&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a name=&#34;B&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;b-setup-for-multiple-projects&#34;&gt;B) Setup for Multiple Projects:&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;(Follow these steps if you want a single Docker environment for all your project)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;1 - Clone this repository anywhere on your machine (similar to &lt;a href=&#34;#A2&#34;&gt;Steps A.2. from above&lt;/a&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone https://github.com/laradock/laradock.git
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your folder structure should look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;+ laradock
+ project-1
+ project-2
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;2 - Go to &lt;code&gt;nginx/sites&lt;/code&gt; and create config files to point to different project directory when visiting different domains.&lt;/p&gt;
&lt;p&gt;Laradock by default includes &lt;code&gt;project-1.conf&lt;/code&gt; and &lt;code&gt;project-2.conf&lt;/code&gt; as working samples.&lt;/p&gt;
&lt;p&gt;3 - change the default names &lt;code&gt;project-n&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;You can rename the config files, project folders and domains as you like, just make sure the &lt;code&gt;root&lt;/code&gt; in the config files, is pointing to the correct project folder name.&lt;/p&gt;
&lt;p&gt;4 - Add the domains to the &lt;strong&gt;hosts&lt;/strong&gt; files.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;127.0.0.1 project-1.dev
127.0.0.1 project-2.dev
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Now jump to the &lt;a href=&#34;#Usage&#34;&gt;Usage&lt;/a&gt; section.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a name=&#34;Usage&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Read Before starting:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you are using &lt;strong&gt;Docker Toolbox&lt;/strong&gt; (VM), do one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Upgrade to Docker &lt;a href=&#34;https://www.docker.com/products/docker&#34;&gt;Native&lt;/a&gt; for Mac/Windows (Recommended). Check out &lt;a href=&#34;http://laradock.io/documentation/#upgrading-laradock&#34;&gt;Upgrading Laradock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Use Laradock v3.*. Visit the &lt;a href=&#34;https://github.com/laradock/laradock/tree/Laradock-ToolBox&#34;&gt;Laradock-ToolBox&lt;/a&gt; branch. &lt;em&gt;(outdated)&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; If you used an older version of Laradock it&amp;rsquo;s highly recommended to rebuild the containers you need to use &lt;a href=&#34;#Build-Re-build-Containers&#34;&gt;see how you rebuild a container&lt;/a&gt; in order to prevent as much errors as possible.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;1 - Enter the laradock folder and rename &lt;code&gt;env-example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;cp env-example .env
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can edit the &lt;code&gt;.env&lt;/code&gt; file to chose which software&amp;rsquo;s you want to be installed in your environment. You can always refer to the &lt;code&gt;docker-compose.yml&lt;/code&gt; file to see how those variables are been used.&lt;/p&gt;
&lt;p&gt;2 - Build the enviroment and run it using &lt;code&gt;docker-compose&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In this example we&amp;rsquo;ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker-compose up -d nginx mysql
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The &lt;code&gt;workspace&lt;/code&gt; and &lt;code&gt;php-fpm&lt;/code&gt; will run automatically in most of the cases, so no need to specify them in the &lt;code&gt;up&lt;/code&gt; command. If you couldn&amp;rsquo;t find them running then you need specify them as follow: &lt;code&gt;docker-compose up -d nginx php-fpm mysql workspace&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can select your own combination of containers form &lt;a href=&#34;http://laradock.io/introduction/#supported-software-images&#34;&gt;this list&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(Please note that sometimes we forget to update the docs, so check the &lt;code&gt;docker-compose.yml&lt;/code&gt; file to see an updated list of all available containers).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &amp;hellip;)&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker-compose exec workspace bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Alternatively, for Windows PowerShell users: execute the following command to enter any running container:&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker exec -it {workspace-container-id} bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can add &lt;code&gt;--user=laradock&lt;/code&gt; to have files created as your host&amp;rsquo;s user. Example:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;docker-compose exec --user=laradock workspace bash
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;You can change the PUID (User id) and PGID (group id) variables from the &lt;code&gt;.env&lt;/code&gt; file)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
4 - Update your project configurations to use the database host&lt;/p&gt;
&lt;p&gt;Open your PHP project&amp;rsquo;s &lt;code&gt;.env&lt;/code&gt; file or whichever configuration file you are reading from, and set the database host &lt;code&gt;DB_HOST&lt;/code&gt; to &lt;code&gt;mysql&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-env&#34;&gt;DB_HOST=mysql
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;If you want to install Laravel as PHP project, see &lt;a href=&#34;#Install-Laravel&#34;&gt;How to Install Laravel in a Docker Container&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
5 - Open your browser and visit your localhost address &lt;code&gt;http://localhost/&lt;/code&gt;. If you followed the multiple projects setup, you can visit &lt;code&gt;http://project-1.dev/&lt;/code&gt; and &lt;code&gt;http://project-2.dev/&lt;/code&gt;. But first don&amp;rsquo;t&lt;/p&gt;
</description>
</item>
</channel>
</rss>