Install Git On Docker

/ Comments off

See the Docker Setup section before installing Mauro using Docker. Git repository ¶ Depending on the operating system of the server you are running on, you may first need to install git to checkout the Mauro application. The concept is simple. Start a container with a bind mount from QTS 2. Build Git from source inside the container with prefix set as the bind mount directory 3. Install into the bind mount directory 4. Set the PATH for BASH on QTS. Let me give you an implementation that works on my machine. I use Container Station which can be installed. Jul 23, 2021 How To Install Docker On Windows 10 Or 7 Without Hyper V H2s Media. Install Docker On Windows Suiously Licious. Installation Of Docker Desktop For Windows Sql Player. Getting Started On Docker For Windows Riff Is Functions. Adding Git Bash To Windows Terminal Adds.

Information

See the Docker Setup section before installing Mauro using Docker.

Git repository¶

Depending on the operating system of the server you are running on, you may first need to install git to checkout the Mauro application. You can read more about installing git on different operating systems here: Getting Started - Installing Git

The Mauro Docker configuration repository can be found here: https://github.com/MauroDataMapper/mdm-docker. Where you clone it is up to you, but on a *nix system we recommend cloning into /opt/ (for optional software packages)

Different branches provide different configurations. We recommend checking out the main branch which will provide the latest releases of back-end and front-end. Alternatively, you can check out a specific tag to install a specific front-end / back-end combination. Tagged releases of Docker take the form Ba.b.c_Fx.y.z where a.b.c is the tagged version of the back-end and x.y.z is the tagged version of the front-end.

Information

If you're running on an internal server with SSH access forbidden by a firewall, you can use the following link to access the repository via HTTPS: SSH over HTTPS document.

Overview¶

The Docker Compose configuration defines two interacting containers:

  • Postgres 12 [postgres] - Postgres Database
  • Mauro Data Mapper [maurodatamapper] - Mauro Data Mapper

The first of these is a standard Postgres container with an external volume for persistent storage. The second builds on the standard Apache Tomcat container, which hosts built versions of the Mauro application. The Postgres container must be running whenever the Mauro application starts. The Mauro container persists logs and Lucene indexes to shared folders which can be found in the docker repository folder.

Default username / password¶

The docker installation is empty on initialisation - it comes with one pre-configured user: with the username [email protected] and thepassword password.

Warning

We strongly recommend changing this password on first login, and then setting up personal user accounts for individual users.

Building¶

Once cloned then running the standard docker-compose build command will build the images necessary to run the services.

Additional Backend Plugins¶

Additional plugins can be found at the Mauro Data Mapper Plugins organisation page. A complete list withversions can also be found in the installation documentation.Please note that while we will do our best to keep this page up-to-date, there may be circumstances where it is behind. Therefore, we recommend usingour official GitHub Plugins organisation to find the latest releases and all available plugins.

Each of these can be added as runtimeOnly dependencies by adding them to the ADDITIONAL_PLUGINS build argument for the mauro-data-mapperservice build.

These dependencies should be provided in a semi-colon separated list in the gradle style, they will be split and each will be added as a runtimeOnlydependency.

Example:

This will add the Excel plugin to the dependencies.gradle file:

Dynamic Versions¶

You can use dynamic versioning to add dependencies, however this comes with a riskthat it pulls a version which does not comply with your expected version of mdm-application-build/mdm-core ,which may cause conflicts with otherplugins. Therefore, we do not advise this approach.

Example

This will add the latest minor version of the Excel plugin.

Theme¶

Mauro comes with a default user interface theme - with the standard blue branding, and default text on the home page. This can be overridden in the docker-compose.yml file, with instructions provided in the Branding guide. The default theme is called default and can be set with:

Install Git On Docker

Running multiple instances¶

If running multiple docker-compose instances then they will all make use of the same initial images, therefore you only need to run the ./make script once per server.

SSH firewalled servers¶

Some servers have the 22 SSH port firewalled for external connections.If this is the case you can change the base_images/sdk_base/ssh/config file:

  • Comment out the Hostname field that's currently active
  • Uncomment both commented out Hostname and Port fields, this will allow git to work using the 443 port which will not be blocked

Run environment¶

By adding variables to the <service>.environment section of the docker-compose.yml file, you can pass them into the container as environment variables. These will overrideany existing configuration variables which are used by default. Any defaults and normally used environment variables can be found in the relevant service's Dockerfile atthe ENV command.

postgres service¶

  • POSTGRES_PASSWORD

    This sets the postgres user password for the service. As per the documentation at Postgres Docker Hub, it must be set for a docker postgres container. We have set a default but you can override if desired. If you do override it, you will also need to change the PGPASSWORD environment variable in the mauro-data-mapper section.

  • DATABASE_USERNAME

    This is the username which will be created inside the Postgres instance to own the database which the MDM service will use. The username is also used by the MDM service to connect to the postgres instance, therefore if you change this you must** also supply it in the environment args for the MDM service.

  • DATABASE_PASSWORD

This is the password set for the DATABASE_USERNAME. It is the password used by the MDM service to connect to this postgres container.

mauro-data-mapper service¶

There are a large amount of variables which either need to be set or can be overridden depending on what plugins have been installed and what featuresyou want. Therefore, you can find all the information on configuring MDM here.

There are 2 environment variables which are not used directly by MDM and these are both optional to be overridden in the compose file.

  • PGPASSWORD

This is the postgres user's password for the postgres server. This is an environment variable set to allow the MDM service to wait till the postgres service has completely finished starting up. It is only used to confirm the Postgres server is running and databases exist. After this it is not used again.

Note

If you change POSTGRES_PASSWORD you must change this to match. This can only** be overridden in the docker-compose.yml file.

  • CATALINA_OPTS

Java Opts to be passed to Tomcat.

Note

This can only be overridden in the docker-compose.yml file.

Environment Notes¶

Database¶

The system is designed to use the postgres service provided in the docker-compose file, therefore there should be no need to alter any of thesesettings. Only make alterations if running postgres as a separate service outside of docker-compose.

Email¶

The standard email properties will allow emails to be sent to a specific SMTP server.

Docker Reference¶

Running¶

Before running please read the parameters section first.

With docker and docker-compose installed, run the following:

If you run everything in the background use Kitematic to see the individual container logs.You can do this if running in the foreground and it is easier as it splits each of the containers up.

If only starting a service when you stop, the service docker will not stop the dependencies that were started to allow the named service to start.

The default compose file will pull the correct version images from Bintray, or a locally defined docker repository.

For more information about administration of your running Docker instance, please see the Administration guide

Gitea provides automatically updated Docker images within its Docker Hub organization. It ispossible to always use the latest stable tag or to use another service that handles updatingDocker images.

This reference setup guides users through the setup based on docker-compose, but the installationof docker-compose is out of scope of this documentation. To install docker-compose itself, followthe official install instructions.

Table of Contents

Basics

The most simple setup just creates a volume and a network and starts the gitea/gitea:latestimage as a service. Since there is no database available, one can be initialized using SQLite3.Create a directory like gitea and paste the following content into a file named docker-compose.yml.Note that the volume should be owned by the user/group with the UID/GID specified in the config file.If you don’t give the volume correct permissions, the container may not start.For a stable release you can use :latest, :1 or specify a certain release like :1.15.3, but if you’d like to use the latest development version of Gitea then you could use the :dev tag.

Ports

To bind the integrated openSSH daemon and the webserver on a different port, adjustthe port section. It’s common to just change the host port and keep the ports withinthe container like they are.

Databases

MySQL database

To start Gitea in combination with a MySQL database, apply these changes to thedocker-compose.yml file created above.

PostgreSQL database

To start Gitea in combination with a PostgreSQL database, apply these changes tothe docker-compose.yml file created above.

Named volumes

To use named volumes instead of host volumes, define and use the named volumewithin the docker-compose.yml configuration. This change will automaticallycreate the required volume. You don’t need to worry about permissions withnamed volumes; Docker will deal with that automatically.

MySQL or PostgreSQL containers will need to be created separately.

Install Git On Docker Container

Startup

To start this setup based on docker-compose, execute docker-compose up -d,to launch Gitea in the background. Using docker-compose ps will show if Giteastarted properly. Logs can be viewed with docker-compose logs.

Install Git On Debian Docker

To shut down the setup, execute docker-compose down. This will stopand kill the containers. The volumes will still exist.

Notice: if using a non-3000 port on http, change app.ini to matchLOCAL_ROOT_URL = http://localhost:3000/.

Git

Installation

After starting the Docker setup via docker-compose, Gitea should be available using afavorite browser to finalize the installation. Visit http://server-ip:3000 and follow theinstallation wizard. If the database was started with the docker-compose setup asdocumented above, please note that db must be used as the database hostname.

Configure the user inside Gitea using environment variables

  • USER: git: The username of the user that runs Gitea within the container.
  • USER_UID: 1000: The UID (Unix user ID) of the user that runs Gitea within the container. Match this to the UID of the owner of the /data volume if using host volumes (this is not necessary with named volumes).
  • USER_GID: 1000: The GID (Unix group ID) of the user that runs Gitea within the container. Match this to the GID of the owner of the /data volume if using host volumes (this is not necessary with named volumes).

Customization

Customization files described here shouldbe placed in /data/gitea directory. If using host volumes, it’s quite easy to access thesefiles; for named volumes, this is done through another container or by direct access at/var/lib/docker/volumes/gitea_gitea/_data. The configuration file will be saved at/data/gitea/conf/app.ini after the installation.

Upgrading

❗❗ Make sure you have volumed data to somewhere outside Docker container ❗❗

To upgrade your installation to the latest release:

Managing Deployments With Environment Variables

In addition to the environment variables above, any settings in app.ini can be set or overridden with an environment variable of the form: GITEA__SECTION_NAME__KEY_NAME. These settings are applied each time the docker container starts. Full information here.

These environment variables can be passed to the docker container in docker-compose.yml. The following example will enable an smtp mail server if the required env variables GITEA__mailer__FROM, GITEA__mailer__HOST, GITEA__mailer__PASSWD are set on the host or in a .env file in the same directory as docker-compose.yml:

To set required TOKEN and SECRET values, consider using gitea’s built-in generate utility functions.

SSH Container Passthrough

Since SSH is running inside the container, SSH needs to be passed through from the host to the container if SSH support is desired. One option would be to run the container SSH on a non-standard port (or moving the host port to a non-standard port). Another option which might be more straightforward is to forward SSH connections from the host to the container. This setup is explained in the following.

This guide assumes that you have created a user on the host called git which shares the same UID/ GID as the container values USER_UID/ USER_GID. These values can be set as environment variables in the docker-compose.yml:

Next mount /home/git/.ssh of the host into the container. Otherwise the SSH authentication cannot work inside the container.

Now a SSH key pair needs to be created on the host. This key pair will be used to authenticate the git user on the host to the container.

In the next step a file named /app/gitea/gitea (with executable permissions) needs to be created on the host. This file will issue the SSH forwarding from the host to the container. Add the following contents to /app/gitea/gitea:

To make the forwarding work, the SSH port of the container (22) needs to be mapped to the host port 2222 in docker-compose.yml . Since this port does not need to be exposed to the outside world, it can be mapped to the localhost of the host machine:

Install Git Docker-compose

In addition, /home/git/.ssh/authorized_keys on the host needs to be modified. It needs to act in the same way as authorized_keys within the Gitea container. Therefore add the public key of the key you created above (“Gitea Host Key”) to ~/git/.ssh/authorized_keys.This can be done via echo '$(cat /home/git/.ssh/id_rsa.pub)' >> /home/git/.ssh/authorized_keys.Important: The pubkey from the git user needs to be added “as is” while all other pubkeys added via the Gitea web interface will be prefixed with command='/app [...].

Install Git On Docker Windows 10

The file should then look somewhat like

Here is a detailed explanation what is happening when a SSH request is made:

  1. A SSH request is made against the host (usually port 22) using the git user, e.g. git clone [email protected]:user/repo.git.
  2. In /home/git/.ssh/authorized_keys , the command executes the /app/gitea/gitea script.
  3. /app/gitea/gitea forwards the SSH request to port 2222 which is mapped to the SSH port (22) of the container.
  4. Due to the existence of the public key of the git user in /home/git/.ssh/authorized_keys the authentication host → container succeeds and the SSH request get forwarded to Gitea running in the docker container.

If a new SSH key is added in the Gitea web interface, it will be appended to .ssh/authorized_keys in the same way as the already existing key.

Notes

SSH container passthrough will work only if

  • opensshd is used in the container
  • if AuthorizedKeysCommand is not used in combination with SSH_CREATE_AUTHORIZED_KEYS_FILE=false to disable authorized files key generation
  • LOCAL_ROOT_URL is not changed