1
- LinuxFr on Docker
2
- -----------------
1
+ LinuxFr with Containers
2
+ -----------------------
3
3
4
4
To simplify set up of a developement environment, LinuxFr.org can be
5
- run on Docker with ` docker-compose up ` .
5
+ run with a container engine like Docker or Podman with the [ ` compose.yml ` ] ( ./compose.yaml )
6
+ file which describe how to build all needed services.
7
+
8
+ If you use the Docker engine, you can use the ` docker compose up ` command to start the system (you
9
+ need to install the [ Docker compose plugin] ( https://docs.docker.com/compose/ ) ).
10
+
11
+ > Note: with the Docker engine, you need to enable the Docker BuildKit builder.
12
+ > Either you have a Docker version which uses it by default, or you set the
13
+ > environment variable ` export DOCKER_BUILDKIT=1 ` .
14
+
15
+ If you use Podman, you can either use the same Docker compose plugin or the
16
+ [ podman-compose] ( https://github.com/containers/podman-compose/ )
17
+ utility. The podman cli itself provide a wrapper of one of these two tools through the
18
+ [ ` podman compose ` command] ( https://docs.podman.io/en/latest/markdown/podman-compose.1.html ) .
19
+
20
+ At this point, the documentation will give you ` docker compose ` commands, but you should be able
21
+ to use ` podman compose ` without any issue.
6
22
7
23
To init the SQL database schema, you need to wait upto the ` database `
8
24
container to be ready to listen MySQL connections.
@@ -16,18 +32,29 @@ For example, you should see in the logs:
16
32
Then, open a second terminal and run:
17
33
18
34
```
19
- docker- compose run linuxfr.org bin/rails db:setup
35
+ docker compose run linuxfr.org bin/rails db:setup
20
36
```
21
37
22
38
Finally, the environment is ready and you can open [ http://dlfp.lo ] ( http://dlfp.lo )
23
39
in your favorite browser.
24
40
25
- Note: to be able to access this URL, you'll need to add the following line
26
- into the ` /etc/hosts ` file of your machine:
41
+ Notes:
42
+
43
+ 1 . to be able to access this URL, you'll need to add the following line
44
+ into the ` /etc/hosts ` file of your machine:
45
+
46
+ ```
47
+ 127.0.0.1 dlfp.lo image.dlfp.lo
48
+ ```
49
+
50
+ 2 . for [ rootless containers] ( https://rootlesscontaine.rs/ ) , you'll need
51
+ to allow standard users to listen on ports less than 1024
52
+ (this is needed because linuxfr use port 80 and 443):
53
+
54
+ ``` sh
55
+ sudo sysctl net.ipv4.ip_unprivileged_port_start=80
56
+ ```
27
57
28
- ```
29
- 127.0.0.1 dlfp.lo image.dlfp.lo
30
- ```
31
58
32
59
Personalize configuration
33
60
=========================
@@ -43,7 +70,7 @@ service.
43
70
44
71
If you want to change the application port and/or other configurations, you can
45
72
[ override] ( https://docs.docker.com/compose/extends/ )
46
- the docker- compose configuration (in particular the ` nginx ` service for
73
+ the docker compose configuration (in particular the ` nginx ` service for
47
74
the port).
48
75
49
76
Notice, that if LinuxFr.org doesn't run on port 80, the image cache
@@ -52,8 +79,8 @@ service won't work well and so you won't be able to see images in the news.
52
79
Test modifications
53
80
==================
54
81
55
- The docker- compose is currently configured to share ` ./app ` , ` ./db ` and
56
- ` ./public ` directories with the docker container.
82
+ The compose file currently shares ` ./app ` , ` ./db ` and
83
+ ` ./public ` directories with the container.
57
84
58
85
So you can update files with your prefered IDE on your machine. Rails
59
86
will directly detect changes and apply them on next page reload.
@@ -62,7 +89,7 @@ Furthermore, if you need to access the Rails console, you need a second
62
89
terminal and run:
63
90
64
91
```
65
- docker- compose run linuxfr.org bin/rails console
92
+ docker compose run linuxfr.org bin/rails console
66
93
```
67
94
68
95
Note: currently, we didn't configure rails to show directly the
@@ -79,10 +106,10 @@ To get help about writing tests, see the
79
106
[ Ruby on Rails documentation] ( https://guides.rubyonrails.org/testing.html#the-rails-test-runner )
80
107
.
81
108
82
- To run tests with Docker environment , you need to use this command:
109
+ To run tests with containers , you need to use this command:
83
110
84
111
```
85
- docker- compose run linuxfr.org bin/rails test -v
112
+ docker compose run linuxfr.org bin/rails test -v
86
113
```
87
114
88
115
Inspect database schema
@@ -92,7 +119,7 @@ In case you need to inspect the database, you need a second terminal
92
119
and run:
93
120
94
121
```
95
- docker- compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails
122
+ docker compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails
96
123
```
97
124
98
125
By default, the requested password is the same as the username.
@@ -104,20 +131,20 @@ In case you need to apply new database migrations, you need a second
104
131
terminal and run:
105
132
106
133
```
107
- docker- compose run linuxfr.org bin/rails db:migrate
134
+ docker compose run linuxfr.org bin/rails db:migrate
108
135
```
109
136
110
137
If you had issue and want to reset all data in your database system,
111
138
use:
112
139
113
140
```
114
- docker- compose run linuxfr.org bin/rails db:reset
141
+ docker compose run linuxfr.org bin/rails db:reset
115
142
```
116
143
117
- Services provided by the docker- compose
144
+ Services provided by the compose file
118
145
=======================================
119
146
120
- Currently, these services are directly enabled by docker- compose:
147
+ Currently, these services are directly enabled by compose:
121
148
122
149
1 . The [ LinuxFr.org] ( https://github.com/linuxfrorg/linuxfr.org )
123
150
ruby on rails application itself
@@ -134,7 +161,7 @@ For now, these services aren't available:
134
161
because it requires to run
135
162
LinuxFr.org with a TLS certificate. When the service will accept to
136
163
fetch articles with simple ` http:// ` , we'll be able to provide it
137
- directly with docker- compose.
164
+ directly with docker compose.
138
165
2 . The [ svgtex service] ( https://github.com/linuxfrorg/svgtex ) , because LinuxFr
139
166
has hard-coded the ` localhost `
140
167
hostname in it's [ HTML Pipeline tool] ( https://github.com/linuxfrorg/html-pipeline-linuxfr/blob/linuxfr/lib/html/pipeline/linuxfr.rb#L8 )
0 commit comments