From 2ab36d248d1eeeda05551014899fddea2b370712 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Tue, 22 Apr 2025 09:54:54 +0200 Subject: [PATCH] Added new README --- .gitignore | 123 ++++++++++++++++++++++++++++++++++++++-- Vagrantfile | 2 +- compose/README.md | 101 +++++++++++++++++++++++++++++++++ docker.sh | 38 +++++++------ swarm/docker_install.sh | 32 ++++++----- 5 files changed, 258 insertions(+), 38 deletions(-) create mode 100644 compose/README.md diff --git a/.gitignore b/.gitignore index 1f76a2f..bd28a07 100755 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,107 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos,vagrant,visualstudiocode,intellij+all,ansible +# Edit at https://www.toptal.com/developers/gitignore?templates=macos,vagrant,visualstudiocode,intellij+all,ansible -# Created by https://www.gitignore.io/api/macos,vagrant,visualstudiocode +### Ansible ### +*.retry + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations ### macOS ### -*.DS_Store +# General +.DS_Store .AppleDouble .LSOverride # Icon must end with two \r Icon + # Thumbnails ._* @@ -28,8 +121,18 @@ Network Trash Folder Temporary Items .apdisk +### macOS Patch ### +# iCloud generated files +*.icloud + ### Vagrant ### +# General .vagrant/ + +# Log files (if you are creating logs in debug mode, uncomment this) +# *.log + +### Vagrant Patch ### *.box ### VisualStudioCode ### @@ -38,9 +141,17 @@ Temporary Items !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files .history +.ionide -### Ansible ### -*.retry - -# End of https://www.gitignore.io/api/macos,vagrant,visualstudiocode,ansible +# End of https://www.toptal.com/developers/gitignore/api/macos,vagrant,visualstudiocode,intellij+all,ansible \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index 1d4a64c..64d342c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,6 +1,6 @@ Vagrant.configure(2) do |config| config.vm.define "docker" do |docker| - docker.vm.box = "bento/ubuntu-18.04" + docker.vm.box = "bento/ubuntu-24.04" docker.vm.network "private_network", ip: "192.168.11.22" docker.vm.hostname = "docker" docker.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync" diff --git a/compose/README.md b/compose/README.md new file mode 100644 index 0000000..29d3862 --- /dev/null +++ b/compose/README.md @@ -0,0 +1,101 @@ +[![Agile611](https://www.agile611.com/wp-content/uploads/2020/09/cropped-logo-header.png)](http://www.agile611.com/) + +# Start Using Docker + +Here is an explanation of the architecture to be used in the training. + +This is an academic setup; it is not intended to be a production environment. + +## Working Repository + +Attached is the work repository we will use during the course: + +[Start Using Docker](https://bitbucket.org/agile611/startusingdocker) + +For the training sessions, computers will be needed, either laptops or desktops. + +## Installation for Local Development + +We need to install these 3 applications on our machines: + +- [GIT](https://git-scm.com/downloads) +- [Vagrant](https://www.vagrantup.com/downloads.html) +- [VirtualBox](https://www.virtualbox.org/wiki/Downloads) + +Vagrant fetches virtual machines from remote repositories, so we advise disconnecting any VPN connections on your machine. + +### Setting Up the Environment + +To download the repository, you need to download the code: + +```shell +git clone https://bitbucket.org/agile611/startusingdocker.git +cd startusingdocker +``` + +From the folder `startusingdocker`, use the following command to set up an Ubuntu 24.04 VM (from now on, the Box): + +```shell +vagrant up +``` +Then, to access the Box, connect via SSH using the following command: + +```shell +vagrant ssh +``` + +### Potential Problems Provisioning the Box + +If you have problems provisioning the Box, you can download it directly from [here](https://portal.cloud.hashicorp.com/vagrant/discover/bento/ubuntu-24.04) depending on your architecture. + +Then, you need to know the path of the Box and execute the following commands: + +```shell +vagrant box add /The/Path/From/Your/Downloaded/box/bento-ubuntu-24-04.box --name bento/ubuntu-24.04 +vagrant init bento/ubuntu-24.04 +``` + +The `init` command creates a VagrantFile with your initial configuration. In the same folder where this Vagrantfile is located, please execute the following command: + +```shell +vagrant up +``` + +Then, connect to the Box using the following command: + +```shell +vagrant ssh +``` + +If you get a terminal from the Box, your environment is ready. + +### Common Networking Problems + +If you have proxies or VPNs running on your machine, it is possible that Vagrant is not able to provision your environment. Please check your connectivity beforehand. + +### Virtualization with VirtualBox + +It is important to ensure that you can virtualize with VirtualBox. If you cannot, you may need to enable VT-X in your machine's BIOS. Here is how to enable it in the BIOS: [How to enable Intel VT-X and AMD SVM in the BIOS](https://www.qnap.com/en/how-to/faq/article/how-to-enable-intel-vt-x-and-amd-svm/) + +### Vagrant Installation Videos + +Here are videos on how to install Vagrant on different platforms: +- [Windows](https://www.youtube.com/watch?v=mPBWWu7sZU4) +- [MacOS](https://www.youtube.com/watch?v=kCVsWyR8mbo) +- [Linux](https://www.youtube.com/watch?v=yGviTwD3hWM) + +To run all this setup, you need to have Git, Vagrant, and VirtualBox installed on your machine. + +## Support + +This tutorial is released into the public domain by [Agile611](http://www.agile611.com/) under the Creative Commons Attribution-NonCommercial 4.0 International license. + +[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC_BY--NC_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc/4.0/) + +This README file was originally written by [Guillem Hernández Sola](https://www.linkedin.com/in/guillemhs/) and is likewise released into the public domain. + +Please contact Agile611 for further details. + +* [Agile611](http://www.agile611.com/) +* Carrer Laureà Miró 309 +* 08950 Esplugues de Llobregat (Barcelona) \ No newline at end of file diff --git a/docker.sh b/docker.sh index 2712da8..725bdcf 100644 --- a/docker.sh +++ b/docker.sh @@ -1,25 +1,27 @@ #!/bin/bash set -eux apt-get update -apt-get install -y --no-install-recommends \ - apt-transport-https \ - ca-certificates \ - curl \ - software-properties-common \ - python-minimal zip python-simplejson \ - gnupg2 \ - software-properties-common -apt-get remove docker docker-engine docker.io -curl -fsSL get.docker.com -o get-docker.sh -sh get-docker.sh +# Add Docker's official GPG key: +apt-get update +apt-get install ca-certificates curl +install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +chmod a+r /etc/apt/keyrings/docker.asc -# install docker-compose -curl -L "https://github.com/docker/compose/releases/download/2.30.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +apt-get update + +# Install Docker latest version +apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y + +# Install docker-compose +curl -L "https://github.com/docker/compose/releases/download/v2.35.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ chmod +x /usr/local/bin/docker-compose -# install docker-machine -curl -L "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-machine && \ - chmod +x /usr/local/bin/docker-machine - -usermod -G docker vagrant +# Add vagrant user to docker group +usermod -G docker vagrant \ No newline at end of file diff --git a/swarm/docker_install.sh b/swarm/docker_install.sh index 2b2e7c8..e3ed275 100755 --- a/swarm/docker_install.sh +++ b/swarm/docker_install.sh @@ -1,21 +1,27 @@ #!/bin/bash set -eux apt-get update -apt-get install -y --no-install-recommends \ - apt-transport-https \ - ca-certificates \ - curl \ - software-properties-common \ - python-minimal zip python-simplejson \ - gnupg2 \ - software-properties-common -apt-get remove docker docker-engine docker.io -curl -fsSL get.docker.com -o get-docker.sh -sh get-docker.sh +# Add Docker's official GPG key: +apt-get update +apt-get install ca-certificates curl +install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +chmod a+r /etc/apt/keyrings/docker.asc -# install docker-compose -curl -L "https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +apt-get update + +# Install Docker latest version +apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y + +# Install docker-compose +curl -L "https://github.com/docker/compose/releases/download/v2.35.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \ chmod +x /usr/local/bin/docker-compose +# Add vagrant user to docker group usermod -G docker vagrant