Skip to content

Commit

Permalink
convert p00 md to rst
Browse files Browse the repository at this point in the history
  • Loading branch information
rimelek committed Feb 20, 2021
1 parent 9b3e9fd commit 998ae57
Show file tree
Hide file tree
Showing 8 changed files with 525 additions and 298 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/.idea
/venv
/docs/_build
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
53 changes: 53 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import sphinx_rtd_theme

# -- Project information -----------------------------------------------------

project = 'Learn Docker'
copyright = '2021, Takács Ákos'
author = 'Takács Ákos'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
93 changes: 93 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.. Learn Docker documentation master file, created by
sphinx-quickstart on Sat Feb 20 20:55:28 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. _xip.io: http://xip.io

========================================
Welcome to Learn Docker's documentation!
========================================

This project contains examples and scripts to help you learn about Docker.

The examples were originally made for the participants of the Ipszilon Seminar in 2017 in Hungary.
The virtual machines were created in the Cloud For Education system.
Some of the scripts may not be useful to you.

Before you begin, clone the git repository:

.. code:: shell
git clone https://github.com/itsziget/learn-docker.git
Scripts
=======

install.sh
contains the installation of all the necessary components except the scripts below.
You may need to restart your machine after the installation.

system/etc/profile.d/fixhost.sh
It fixes the missing hostname in :code:`/etc/hosts`,
so you will not see error messages after using "sudo". The script checks if the machine's
hostname is in the hosts file and writes into the file if the hostname was missing.
In case of Ubuntu 16.04 it can copied into /etc/profile.d/.

system/usr/local/bin/xip.sh
`xip.io` generates domain names for the public DNS server based on
the current WAN or LAN IP address of the host machine.
It must be copied into /usr/local/bin/ with the filename "xip".
When you execute "xip", a domain name will be shown (Ex.: 192.168.1.2.xip.io) which you can use for the examples.
The command takes one optional parameter as a subdomain. Ex.: "xip web1". The result would be: web1.192.168.1.2.xip.io

system/etc/profile.d/xip.variable.sh
It uses the xip command to set the XIP environment variable so
you can use the variable in a docker-compose.yml too.

Make sure you each script is executable before you continue. However, the above scripts are optional and you may not need
them in a local virtual machine. If you don't want to rely on automatic IP address detection, set the XIP variable manually.

Example projects
================

Example projects are in the `learn-docker/projects` folder, so go to there.

.. code: shell
cd learn-docker/projects
Check the existence of :code:`$XIP` variable since you will need it for some examples:

.. code: shell
echo $XIP
If it does not exist or empty, then set the value manually or run the script below:

.. code: shell
export XIP=$(ip route get 8.8.8.8 | grep -o 'src [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+' | awk '{print $NF}')
# or if xip is already installed:
export XIP=$(xip)
All off the examples were tested with Docker 20.10.1. The version of Docker Compose was 1.27.4.
You can try with more recent versions but some behaviour could be different in the future.

* [p00](projects/p00/README.md): Collection of basic commands
* [p01](projects/p01/README.md): Start a simple web server with mounted document root.
* [p02](projects/p02/README.md): Build yur own web server image and copy the document root into the image.
* [p03](projects/p03/READMe.md): Create your own PHP application with built-in PHP web server.
* [p04](projects/p04/README.md): Create a simple [Docker Compose](https://docs.docker.com/compose/) project.
* [p05](projects/p05/README.md): Communication of PHP and Apache HTTPD web serverwith the help of [Docker Compose](https://docs.docker.com/compose/).
* [p06](projects/p06/README.md): Run more [Docker Compose](https://docs.docker.com/compose/) project on the same port using [nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy).
* [p07](projects/p07/README.md): Protect your web server with HTTP authentication
* [p08](projects/p08/README.md): Memory limit test with PHP in a container.
* [p09](projects/p09/README.md): CPU limit test

.. toctree::
:maxdepth: 2
:caption: Projects:

projects/p00
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd

0 comments on commit 998ae57

Please sign in to comment.