<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Antoine</title>
    <description>The latest articles on DEV Community by Antoine (@ant1ne).</description>
    <link>https://dev.to/ant1ne</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F956019%2Fa80c82ab-5189-46d7-92d8-80db9f3db35f.jpeg</url>
      <title>DEV Community: Antoine</title>
      <link>https://dev.to/ant1ne</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ant1ne"/>
    <language>en</language>
    <item>
      <title>Set up WordPress with Docker compose</title>
      <dc:creator>Antoine</dc:creator>
      <pubDate>Mon, 15 May 2023 13:14:55 +0000</pubDate>
      <link>https://dev.to/ant1ne/set-up-wordpress-with-docker-compose-13o0</link>
      <guid>https://dev.to/ant1ne/set-up-wordpress-with-docker-compose-13o0</guid>
      <description>&lt;p&gt;Docker compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.&lt;/p&gt;

&lt;p&gt;Itʼs worth noting that all required images are acquired from &lt;a href="https://hub.docker.com/"&gt;Docker Hub&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://hub.docker.com/_/wordpress"&gt;WordPress&lt;/a&gt; - the official WordPress Docker image with all WordPress files, Apache server and PHP;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://hub.docker.com/_/mysql"&gt;MySQL&lt;/a&gt; - required for MySQL root user, password, and database connection variables;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://hub.docker.com/_/phpmyadmin"&gt;phpMyAdmin&lt;/a&gt; - a web application for managing databases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Check Docker Compose version&lt;/strong&gt;&lt;br&gt;
Open your favorite command line interface and check the Docker Compose installation version:&lt;br&gt;
&lt;code&gt;docker compose version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will confirm that the Compose module is working correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a project folder&lt;/strong&gt;&lt;br&gt;
Create a new project directory for WordPress application and navigate to it with the following command:&lt;br&gt;
&lt;code&gt;mkdir ~/wordpress &amp;amp;&amp;amp; cd ~/wordpress&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the docker-compose.yml file&lt;/strong&gt;&lt;br&gt;
Using your preferred text editor, create a new &lt;strong&gt;docker-compose.yml&lt;/strong&gt; file and add the contents below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3" 
# Defines which compose version to use
services:
  # Services line define which Docker images to run. In this case, it will be MySQL server and WordPress image.
  db:
    image: mysql:5.7
    # image: mysql:5.7 indicates the MySQL database container image from Docker Hub used in this installation.
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: MyR00tMySQLPa$$5w0rD
      MYSQL_DATABASE: MyWordPressDatabaseName
      MYSQL_USER: MyWordPressUser
      MYSQL_PASSWORD: Pa$$5w0rD
      # Previous four lines define the main variables needed for the MySQL container to work: database, database username, database user password, and the MySQL root password.
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    restart: always
    # Restart line controls the restart mode, meaning if the container stops running for any reason, it will restart the process immediately.
    ports:
      - "8000:80"
      # The previous line defines the port that the WordPress container will use. After successful installation, the full path will look like this: http://localhost:8000
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: MyWordPressUser
      WORDPRESS_DB_PASSWORD: Pa$$w0rD
      WORDPRESS_DB_NAME: MyWordPressDatabaseName
# Similar to MySQL image variables, the last four lines define the main variables needed for the WordPress container to work properly with the MySQL container.
    volumes:
      ["./:/var/www/html"]
volumes:
  mysql: {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run Docker compose&lt;/strong&gt;&lt;br&gt;
With the &lt;strong&gt;docker-compose.yml&lt;/strong&gt; created, run the following command in the same wordpress directory to create and start the containers:&lt;br&gt;
&lt;code&gt;docker compose up -d&lt;/code&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>docker</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>How to install WordPress with Docker</title>
      <dc:creator>Antoine</dc:creator>
      <pubDate>Mon, 15 May 2023 13:08:44 +0000</pubDate>
      <link>https://dev.to/ant1ne/how-to-install-wordpress-with-docker-2jcn</link>
      <guid>https://dev.to/ant1ne/how-to-install-wordpress-with-docker-2jcn</guid>
      <description>&lt;p&gt;Lately, for a technical interview, I have been asked the following task: install WordPress with Docker and explain how you do it.&lt;/p&gt;

&lt;p&gt;Before jumping on how I have done it, let's clarify what is Docker and its composition.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Docker?
&lt;/h3&gt;

&lt;p&gt;Docker is a platform that allows containerisation of software packages (e.g. build, ship, run the software anywhere) based on Linux kernel (but Windows and MacOS are also supported).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does it contain?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker is composed of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a client&lt;/li&gt;
&lt;li&gt;a host&lt;/li&gt;
&lt;li&gt;a registry&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eP6NeJDY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kosbqxvl7l7po7jm70vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eP6NeJDY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kosbqxvl7l7po7jm70vw.png" alt="Docker composition" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;client&lt;/strong&gt; is Docker CLI (Command Line Interface), this app runs in the terminal.&lt;br&gt;
The &lt;strong&gt;host&lt;/strong&gt; runs in the background, it manages the containers and images.&lt;br&gt;
The &lt;strong&gt;registry&lt;/strong&gt; is where the images are pushed to.&lt;/p&gt;

&lt;h3&gt;
  
  
  WordPress
&lt;/h3&gt;

&lt;p&gt;I don't think I need to introduce WordPress, but if you don't know it, you can check the following &lt;a href="https://kinsta.com/knowledgebase/what-is-wordpress/"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, I need to spend more time explaining how to install WordPress with Docker.&lt;/p&gt;

&lt;p&gt;There are two methods available to install and set up WordPress on Docker:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dev.to/ant1ne/set-up-wordpress-with-docker-cli-3oj6"&gt;with the CLI&lt;/a&gt;,&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/ant1ne/set-up-wordpress-with-docker-compose-13o0"&gt;with Docker compose&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>docker</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>Set up WordPress with Docker CLI</title>
      <dc:creator>Antoine</dc:creator>
      <pubDate>Mon, 15 May 2023 13:07:05 +0000</pubDate>
      <link>https://dev.to/ant1ne/set-up-wordpress-with-docker-cli-3oj6</link>
      <guid>https://dev.to/ant1ne/set-up-wordpress-with-docker-cli-3oj6</guid>
      <description>&lt;p&gt;Before installing WordPress with Docker you will need to have somewhere to store the data. MariaDB is a community-developed relational database management system and a drop-in replacement for MySQL. It is officially available on Docker and provides easy instructions with up to date images.&lt;/p&gt;

&lt;h2&gt;
  
  
  MariaDB with Docker
&lt;/h2&gt;

&lt;p&gt;Start off by making a new directory where you wish to store the files for WordPress and MariaDB for example in your home directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mkdir ~/wordpress &amp;amp;&amp;amp; cd ~/wordpress&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Downloading and installing a new MariaDB container can all be performed with a single command. Before jumping in check the required parameters.&lt;/p&gt;

&lt;p&gt;MariaDB Environment variables are marked in the Docker command with &lt;em&gt;-e&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-e MYSQL_ROOT_PASSWORD=&lt;/code&gt;- set your own password here.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-e MYSQL_DATABASE=&lt;/code&gt; - creates and names a new database e.g. wordpress.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Docker parameters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;–name wordpressdb&lt;/code&gt; – names the container;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-v “$PWD/database”:/var/lib/mysql&lt;/code&gt; – creates a data directory linked to the container storage to ensure data persistence;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-d&lt;/code&gt; – tells Docker to run the container in daemon;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mariadb:latest&lt;/code&gt; – finally defines what to install and which version.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then run the command below while replacing the  with your own.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -e MYSQL_ROOT_PASSWORD=&amp;lt;password&amp;gt; -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mariadb:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
Status: Downloaded newer image for mariadb:latest
23df0ec2e48beb1fb8704ba612e9eb083f4193ecceb11102bc91232955cccc54
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Docker was successful at creating the container, you should see a code at the end of the output similar to the example above. You can confirm that the MariaDB container is running by using the following command:&lt;br&gt;
&lt;code&gt;docker ps&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check the status for your MariaDB install, it should show “Up” and the time it has been running like in the example output below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONTAINER ID IMAGE          COMMAND                CREATED        STATUS        PORTS      NAMES
14649c5b7e9a mariadb:latest "/docker-entrypoint.s" 12 seconds ago Up 12 seconds 3306/tcp   wordpressdb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other useful commands for working with containers are &lt;code&gt;start&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt; and &lt;code&gt;remove&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker start &amp;lt;container name&amp;gt;
docker stop &amp;lt;container name&amp;gt;
docker rm &amp;lt;container name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find out more about available commands and options for specific commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker --help
docker &amp;lt;command&amp;gt; --help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Full command-line documentation is also available over at the &lt;a href="https://docs.docker.com/engine/reference/commandline/cli/"&gt;Docker support page&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  WordPress with Docker
&lt;/h2&gt;

&lt;p&gt;Applications in containers run isolated from one another in the user's space of the host operating system sharing the kernel with other containers. This reduces the overhead required to run packaged software while also enabling the containers to run on any kind of infrastructure. To allow applications within different containers to work with one another Docker supports container linking.&lt;/p&gt;

&lt;p&gt;WordPress is also made &lt;a href="https://hub.docker.com/_/wordpress/"&gt;officially available on Docker Hub&lt;/a&gt;, pull the image using the command below. When the version to download is not specified Docker will fetch the latest available.&lt;br&gt;
&lt;code&gt;docker pull wordpress&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;WordPress container also takes environment variables and Docker parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-e WORDPRESS_DB_PASSWORD=&lt;/code&gt; - sets the same database password here;
– &lt;code&gt;-name wordpress&lt;/code&gt; – gives the container a name;
– &lt;code&gt;-link wordpressdb:mysql&lt;/code&gt; – links the WordPress container with the MariaDB container so that the applications can interact;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-p 80:80&lt;/code&gt; – tells Docker to pass connections from your server’s HTTP port to the containers internal port 80;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-v “$PWD/html”:/var/www/html&lt;/code&gt; – sets the WordPress files accessible from outside the container. The volume files will remain even if the container was removed;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-d&lt;/code&gt; – makes the container run on background&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-wordpress&lt;/code&gt; – tells Docker what to install. Uses the package downloaded earlier with the &lt;code&gt;docker pull wordpress&lt;/code&gt; -command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the command below while replacing the  as you did for the MariaDB container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=&amp;lt;password&amp;gt; --name wordpress --link wordpressdb:mysql -p 80:80 -v "$PWD/html":/var/www/html -d wordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open your server’s domain name or IP address in a web browser to test the installation. You should be redirected to the initial WordPress setup page at http:///wp-admin/install.php. Go through the setup wizard and you are done.&lt;/p&gt;

&lt;p&gt;If you get an error linking your server’s public IP address to the WordPress container’s internal address, remove the failed container using the following command:&lt;br&gt;
&lt;code&gt;docker rm wordpress&lt;/code&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>docker</category>
      <category>wordpress</category>
    </item>
    <item>
      <title>How to make public repository of private fork</title>
      <dc:creator>Antoine</dc:creator>
      <pubDate>Tue, 21 Mar 2023 09:43:24 +0000</pubDate>
      <link>https://dev.to/ant1ne/how-to-make-public-repository-of-private-fork-4jnp</link>
      <guid>https://dev.to/ant1ne/how-to-make-public-repository-of-private-fork-4jnp</guid>
      <description>&lt;p&gt;While studying Fullstack development with &lt;a href="https://integrify.academy/international/"&gt;Integrify&lt;/a&gt;'s bootcamp, I have created a couple of private forks from repositories from the different assignments I had to do to learn.&lt;br&gt;
This is all great until the moment you actually need to showcase your portfolio and what you have done during this intense but great learning.&lt;br&gt;
I have faced the issue of making public repository of private fork.&lt;/p&gt;

&lt;p&gt;Here are the commands:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.github.com/en/get-started/quickstart/create-a-repo"&gt;Create an empty public repository&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Terminal&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)&lt;br&gt;
&lt;code&gt;$ git clone --bare https://github.com/exampleuser/private_repo.git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mirror-push to the new repository&lt;br&gt;
&lt;code&gt;$ cd private_repo.git&lt;/code&gt;&lt;br&gt;
&lt;code&gt;$ git push --mirror https://github.com/yourname/public_repo.git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remove the temporary local repository you created earlier&lt;br&gt;
&lt;code&gt;$ cd ..&lt;/code&gt;&lt;br&gt;
&lt;code&gt;$ rm -rf private_repo.git&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here you are with your former private fork/repository in your new public one ready to be showcased!&lt;/p&gt;

&lt;p&gt;Hope this explanation helps you as much as it helps me!&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
