Skip to content

Commit

Permalink
Copy editing installation instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jul 26, 2023
1 parent 5ddd5c1 commit 7094b67
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 52 deletions.
78 changes: 78 additions & 0 deletions docs/docker-ubuntu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Installing the Docker Engine on Ubuntu

Further details can be found under: `https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository`


## Install using the repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

1. Set up the repository: Update the apt package index and install packages to allow apt to use a repository over HTTPS:

```bash
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
```

2. Add Docker’s official GPG key:

```bash
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
```

3. Use the following command to set up the repository:

```bash
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```

4. Install Docker Engine
Update the apt package index:

```bash
sudo apt-get update
```

5. Install latest Docker Engine, containerd, and Docker Compose:

```bash
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
```

**Docker Compose** is a tool for defining and running multi-container Docker applications. A series of `*.yaml` files
are used configure the required services for the application. This means all container services can be brought up in a
single command.

You can check your current **Docker** and **Docker Compose** versions using the following commands:

```bash
docker version
docker compose version
```

Please ensure that you are using Docker version 20.10 or higher and Docker Compose 1.29 or higher and upgrade if
necessary.


> **Important** In recent versions, `docker-compose` is already included as part of of the main `docker` client, Please
> ensure that you are using Docker version 24.0.4 or higher and Docker Compose 2.29.1 or higher and upgrade if necessary.
> If you are unable to upgrade and stuck using an older version you can still run the tutorials by adding a `legacy`
> parameter at the end the `./services` script commands e.g. `services start legacy`

If using a Linux distro with an outdated `docker-compose`, the files can be installed directly as shown:

```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```

If you are using docker-compose in Ubuntu with VMWare and faced the following error: _ERROR: Couldn't connect to Docker
daemon at http+docker://localunixsocket - is it running?_
It can be solved by owning the `/var/run/docker.sock` Unix socket as shown:
```bash
sudo chown $USER /var/run/docker.sock
```
63 changes: 11 additions & 52 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,63 +43,27 @@ can choose which enablers are of interest to you.

## Prerequisites

### Swagger <img src="https://static1.smartbear.co/swagger/media/assets/swagger_fav.png" align="left" height="30" width="30" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">
The NGSI-LD tutorials are designed to run under any Unix environment, the tested
configuration and [GitPod](https://github.com/gitpod-io/gitpod) environment is currently based on Ubuntu 22.04.2 LTS.
However, there may be some minor issues when running the tutorials directly on Windows
machines or Apple M1 Silicon `amd64` systems, and the following
[Virtual Box set-up](virtual-box.md) can be used when facing issues.

The OpenAPI Specification (commonly known as Swagger) is an API description format for REST APIs. A Swagger spec allows
you to describe an entire API (such as NGSI-LD itself) however in this tutorial we shall be concentrating on using
Swagger to define data models.

API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines.
The complete OpenAPI Specification can be found on GitHub:
[OpenAPI 3.0 Specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md). This is
important since we will need a well-defined structure to be able to generate `@context` files.
### Docker and Docker Compose <img src="https://www.docker.com/favicon.ico" align="left" height="30" width="30" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">

### Docker and Docker Compose <img src="./img/docker.ico" align="left" height="36" width="36" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">

To keep things simple, all components will be run using [Docker](https://www.docker.com). **Docker** is a container
To keep things simple all components will be run using [Docker](https://www.docker.com). **Docker** is a container
technology which allows to different components isolated into their respective environments.

- To install Docker on Windows follow the instructions [here](https://docs.docker.com/docker-for-windows/).
- To install Docker on Mac follow the instructions [here](https://docs.docker.com/docker-for-mac/).
- To install Docker on Linux follow the instructions [here](https://docs.docker.com/install/).

**Docker Compose** is a tool for defining and running multi-container Docker applications. A series of `*.yaml` files
are used to configure the required services for the application. This means all container services can be brought up in
a single command. Docker Compose is installed by default as part of Docker for Windows and Docker for Mac, however Linux
users will need to follow the instructions found [here](https://docs.docker.com/compose/install/).

You can check your current **Docker** and **Docker Compose** versions using the following commands:

```bash
docker-compose -v
docker version
```

> **Important** In recent versions, `docker-compose` is already included as part of the main `docker` client, Please
> ensure that you are using Docker version 20.10 or higher and Docker Compose 1.29 or higher and upgrade if necessary.
> If you are unable to upgrade and stuck using an older version you can still run the tutorials by adding a `legacy`
> parameter at the end the `./services` script commands e.g. `services start legacy`
If using a linux distro with an outdated docker-compose, the files can be installed directly as shown:
- To install Docker on Mac/OS follow the instructions [here](https://docs.docker.com/docker-for-mac/).
- To install Docker on Unix follow the instructions [here](./docker-ubuntu.md).

```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```

If you are using docker-compose in Ubuntu with VMware and faced the following error: _ERROR: Couldn't connect to Docker
daemon at `http+docker://localunixsocket` - is it running?_

It can be solved by owning the `/var/run/docker.sock` Unix socket as shown:

```bash
sudo chown $USER /var/run/docker.sock
```

### Postman <img src="./img/postman.png" align="left" height="25" width="35" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">

The tutorials which use HTTP requests supply a collection for use with the Postman utility. Postman is a testing
framework for REST APIs. The tool can be downloaded from [www.postman.com](https://www.postman.com/downloads/). All the
framework for REST APIs. The tool can be downloaded from [www.getpostman.com](https://www.getpostman.com). All the
FIWARE Postman collections can be downloaded directly from the
[Postman API network](https://explore.postman.com/team/3mM5EY6ChBYp9D).

Expand All @@ -109,12 +73,7 @@ FIWARE Postman collections can be downloaded directly from the
development environments that spins up an automated dev environment for each task, in the cloud. It enables you to run
the tutorials in a cloud development environment directly from your browser or your Desktop IDE.

### Cygwin for Windows <img src="https://www.cygwin.com/favicon.ico" align="left" height="30" width="30" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">

The tutorials start up their services using a simple Bash script. When working locally, Windows users should download
[cygwin](http://www.cygwin.com/) to provide a command-line functionality similar to a Linux distribution on Windows.

### Apache Maven <img src="./img/maven.png" align="left" height="30" width="30" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">
### Apache Maven <img src="https://maven.apache.org/favicon.ico" align="left" height="30" width="30" style="border-right-style:solid; border-right-width:10px; border-color:transparent; background: transparent">

[Apache Maven](https://maven.apache.org/download.cgi) is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a
Expand Down
36 changes: 36 additions & 0 deletions docs/virtual-box.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@


# Virtual Box Setup

Windows and Mac are able to emulate a Unix system when running [VirtualBox](https://www.virtualbox.org/) - the following minimal set-up is recommended:

- VirtualBox
- Ubuntu 22.04.2 2G RAM 25G Disk
- Docker Engine on Ubuntu: Docker 24.0.4 and Docker compose 2.19.1

Download Virtualbox from [here](https://www.virtualbox.org/)

## Ubuntu

Download Ubuntu LTS from [here](https://ubuntu.com/download/desktop)

To set up the working environment, follow these steps:
- Open Virtualbox and create a new virtual machine.
- Select the ISO image downloaded earlier (.iso file).
- Choose a username and a password. Check the "Guest Additions" option (to enable features such as shared clipboard and shared folders).
- Set the memory size to 2GB and allocate 2 CPUs.
- Create a virtual hard disk with a size of 25GB.
- Finish the setup process and start the virtual machine.

If you encounter the error _"Username is not in the sudoers file. This incident will be reported"_ when attempting to execute a `sudo` command, follow these steps to resolve the issue:

- Restart your virtual machine. While restaring, press the Shift key for a few seconds to get the Grub boot menu.
- Using the Down Arrow, select "Advanced options for Ubuntu" and press Enter.
- Select the kernel with the "recovery mode" option and press Enter to open the Recovery menu.
- In the "Recovery menu", move over to the line "root Drop to root shell prompt", then press Enter.
- Use the root password and press Enter to start the "maintenance mode".
- At this point, you should be at the root shell prompt. Change the system to be mounted as read/write by running the command: "mount -o rw,remount /"
- Execute the following command to add the user to the sudo group: "adduser username sudo" (use the actual username on the system).
- Type the exit command to go back to the "Recovery menu": "Exit"
- Use the Right Arrow to select `<Ok>` and press Enter.
- Press `<Ok>` to continue with normal boot sequence.
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ nav:
- Cloud Edge Computing: edge-computing.md
- Appendix:
- Data Models: datamodels.md
- Installing Docker: docker-ubuntu.md
- Using Virtual Box: virtual-box.md

0 comments on commit 7094b67

Please sign in to comment.