summaryrefslogtreecommitdiffstats
path: root/README.rst
blob: a7db713a87a396f02c9a9a3947d5ac4844a7d247 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
This project consists of an HTML static website powered by NginX.


________________________________________________________________________

Versioning
==========

Pre-release a test version
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: BASH

	./bin/release_test	 X.Y-extraversion;
	git push origin		vX.Y-extraversion;

Release a stable version
^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: BASH

	./bin/release_stable	 X.Y;
	git push origin		vX.Y;

Build and push multi-arch Docker images
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This creates and pushes images for all the supported architectures from
a single building machine, and also a multi-arch manifest.  This command
also stores the digest of the created images in ``<./etc/docker/images/www>``.

To avoid loading different docker images with the same name (possibly crafted
by crackers), the build system specifies the digests of the docker images
in ``<./etc/docker/images/www>``.

.. code-block:: BASH

	make image;

Release first patch vX.Y.0
^^^^^^^^^^^^^^^^^^^^^^^^^^

The previous ``make image`` stored the digest of the released image.  The
stable releases need to use that image, so the first patch will do that.

.. code-block:: BASH

	git checkout	vX.Y;
	make digest;
	git commit -am 'Specify digest of X.Y';
	git tag -a vX.Y.0 -m 'Release X.Y.0';
	git push origin	vX.Y.0;

Continue after a release + patch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note that the ``main`` branch shall not receive the patches ``vX.Y.Z``, and
should instead continue from ``vX.Y``, so after running the code above and
deploying the image, the user should go back to ``main``.

.. code-block:: BASH

	git checkout main;


________________________________________________________________________

Deployment
==========

This repository assumes a docker swarm is already running.  See the
`parent repository`_ to know how to prepare the machines for docker swarm.

Releases use port 30001.
Pre-releases use port 31001.

For a seamless deployment, the following steps need to be done:

- Assuming there is an old stack deployed at port 30001.

- `Pre-release a test version`_ (see above).

- `Build and push multi-arch Docker images`_ (see above).

- Deploy the test pre-release at port 31001:

.. code-block:: BASH

	sudo make stack-deploy;


- If the pre-release isn't good engough, that deployment has to be removed.
  The current stable deployment is left untouched.

.. code-block:: BASH

	make stack-rm-test;


- Else, if the pre-release passes the tests, the published port should be
  forwarded to 31001 (this is done in the nlb_ repository).

- `Release a stable version`_ (see above).

- `Build and push multi-arch Docker images`_ (see above).

- `Release first patch vX.Y.0`_ (see above).

- Remove the oldstable release, and deploy the stable release at port 30001:

.. code-block:: BASH

	make stack-rm-stable;
	sudo make stack-deploy;

- The published port should be forwarded back to 30001 (this is done in
  the nlb_ repository).

- Remove the test deployment at port 31001:

.. code-block:: BASH

	make stack-rm-test;


________________________________________________________________________

_`parent repository`: https://github.com/alejandro-colomar/server.git

_`nlb`: https://github.com/alejandro-colomar/nlb.git