1CHART-core README
2=================
3
4Introduction
5------------
6
7See https://confluence.eumetsat.int/display/SAE/CHART+based+Projects for more information.
8
9Prerequisites
10-------------
11
12We try to use a standard set of prerequisites for CHART projects.
13
14Use requisites.txt to take the latest version of all of them, of requisites-current.txt
15to match what we are currently installing on the operational systems.
16
17chart-rest
18----------
19
20To import the CDAT API support directory into this repository use:
21
22git subtree add --squash -P chart-rest git@gitlab.eumetsat.int:cdat/chart-rest.git master
23
24To update use:
25TBD
26
27For adding CDAT support to projects see [KB article, TBD]
28 - latest core includes urls.py and the chart-rest dir and settings.CDAT_URL
29 - config domains in CDAT
30 - Link from project homepage - find something nicer that returns us to 3x3 layout
31 - think about live links
32
33Docker
34------
35
36Overview
37~~~~~~~~
38
39The docker/ directory contains scripts and Dockerfiles to build images for running CHART projects. They can be built with either the build.sh script, or docker-compose, or built manually.
40
41Images
42~~~~~~
43
44The following images are built:
45
46- OS (docker/os/Dockerfile): The is a base layer and consists of an Ubuntu LTS image with a few essential packages including python3 interpreter
47- Prereq (docker/prereq/Dockerfile): Adds all CHART prerequisites including Python modules and other tools for running all CHART projects, including basemap library and Oracle instantclient libraries
48- Core (docker/prereq/Dockerfile): Adds the CHART-core code to prereq.
49
50In order to run a CHART based project through docker you will also need to build a project image. These are build on top of the core image, which must be built first.
51
52Alternatively you can run a CHART project using the docker prerequisites but executing code directly from the host machine, using the prereq image.
53
54If you are looking to run the CDAT in EUMETSAT then look at the https://gitlab.eumetsat.int/cdat/cdat-eum-deploy repository and not this one.
55
56Build images with built script
57~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
59Run:
60
61$ docker/build.sh
62
63See also docker/env.sh which has some adjustable settings, but for development the defaults are fine. This creates all images listed above.
64
65If you're on an old Centos OS and see errors:
66"Please provide a source image with `from` prior to commit"
67Then edit the prereq and core Dockerfiles to comment out the line "ARG *_TAG=latest" and replace the ${*_TAG} in the next line with either the OS tag or prereq tag in use (probably "latest" unless you are preparing a build for formal deployment).
68
69
70Build with docker compose
71~~~~~~~~~~~~~~~~~~~~~~~~~
72
73Run:
74
75$ docker-compose build
76
77This is not yet written.
78
79Cleanup
80~~~~~~~
81
82To tidy up some temporary files run:
83
84$ docker/clean.up
85
86Add the "--force" flag to wipe all docker content (all images, all containers, all volumes) from the machine with no further prompts. This includes any non-CHART docker content too.
87
88NIS users and mapping
89~~~~~~~~~~~~~~~~~~~~~
90
91TBD
92
93Running containers
94~~~~~~~~~~~~~~~~~~
95
96Source the docker/env.sh file before running the following commands:
97
98$ source docker/env.sh
99
100To start the OS image with a shell prompt:
101
102$ docker run --rm --name os --hostname chart --interactive --tty chart/os:${OS_TAG} /bin/bash
103
104Omit /bin/bash to run a OS test instead.
105
106To start the prereq image with a shell prompt:
107
108$ docker run --rm --name prereq --hostname chart --interactive --tty chart/prereq:${PREREQ_TAG} /bin/bash
109
110Omit /bin/bash to run the environment test.
111
112To start the core image with a shell prompt:
113
114$ docker run --rm --name core --hostname chart --interactive --tty chart/core:${CORE_TAG} /bin/bash
115
116Omit /bin/bash to run the core automated tests.
117
118To start the prereq image with a shell prompt with some example mounted directories from the host machine,
119ready to run a project:
120
121$ docker run --rm --name chart --hostname chart --net host \
122 --mount type=bind,source=$HOME,target=/opt,readonly \
123 --interactive --tty chart/prereq:${PREREQ_TAG} /bin/bash
124
125You can customise the directories, or add additional mounts with more "--mount" options, and edit exported ports.
126
127To enter a running base image with a new prompt:
128
129$ docker exec --rm --name chart --interactive --tty /bin/bash
130
131If you want to run a debug web server inside a core container use:
132
133$ /opt/<project>/bin/<project> django_manage runserver --noreload 0.0.0.0:10000
134$ /opt/charts3/bin/charts3 django_manage runserver --noreload 0.0.0.0:10000
135
136On an older system the "--mount" option isn't available to use the older "--volume=$HOME,/opt,ro" version.
137
138
139$ docker run --rm --name chart --hostname chart --net host --user 10172 --volume=$HOME:/opt:ro \
140--interactive --tty chart/prereq:latest /bin/bash