@@ -2,33 +2,34 @@ LinuxFr on Docker
22-----------------
33
44To simplify set up of a developement environment, LinuxFr.org can be
5- run on Docker with ` docker- compose up ` .
5+ run on Docker with ` docker compose up ` .
66
77To init the SQL database schema, you need to wait upto the ` database `
8- and ` database-test ` containers are ready to listen MySQL connections.
8+ container to be ready to listen MySQL connections.
99
1010For example, you should see in the logs:
1111
12- > database-test_1 | 2020-09-21 16:03:12 140126029907968 [ Note] mysqld: ready for connections.
13- >
14- > database-test_1 | Version: '10.1.46-MariaDB-1\~ bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
15- >
1612> database_1 | 2020-09-21 16:03:12 139820938893312 [ Note] mysqld: ready for connections.
1713>
1814> database_1 | Version: '10.1.46-MariaDB-1\~ bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
1915
16+ Or you can check the ` database ` container status to be "healthy".
17+
2018Then, open a second terminal and run:
2119
2220```
23- docker- compose run linuxfr.org bin/rails db:setup
21+ docker compose exec linuxfr.org bin/rails db:setup
2422```
2523
2624Finally, the environment is ready and you can open [ http://dlfp.lo ] ( http://dlfp.lo )
2725in your favorite browser.
2826
29- Note: to be able to access this URL, you'll need to add the line
30- ` 127.0.0.1 dlfp.lo image.dlfp.lo ` to the ` /etc/hosts ` file of your
31- machine.
27+ Note: to be able to access this URL, you'll need to add the following line
28+ into the ` /etc/hosts ` file of your machine:
29+
30+ ```
31+ 127.0.0.1 dlfp.lo image.dlfp.lo
32+ ```
3233
3334Personalize configuration
3435=========================
@@ -44,7 +45,7 @@ service.
4445
4546If you want to change the application port and/or other configurations, you can
4647[ override] ( https://docs.docker.com/compose/extends/ )
47- the docker- compose configuration (in particular the ` nginx ` service for
48+ the docker compose configuration (in particular the ` nginx ` service for
4849the port).
4950
5051Notice, that if LinuxFr.org doesn't run on port 80, the image cache
@@ -53,7 +54,7 @@ service won't work well and so you won't be able to see images in the news.
5354Test modifications
5455==================
5556
56- The docker- compose is currently configured to share ` ./app ` , ` ./db ` and
57+ The docker compose is currently configured to share ` ./app ` , ` ./db ` and
5758` ./public ` directories with the docker container.
5859
5960So you can update files with your prefered IDE on your machine. Rails
@@ -62,39 +63,61 @@ will directly detect changes and apply them on next page reload.
6263Furthermore, if you need to access the Rails console, you need a second
6364terminal and run:
6465
65- ` docker-compose run linuxfr.org bin/rails console `
66+ ```
67+ docker compose exec linuxfr.org bin/rails console
68+ ```
6669
6770Note: currently, we didn't configure rails to show directly the
6871` webconsole ` in your browser. That's just because of time needed to
6972find the good configuration, any help will be appreciated !
7073
71- Inspect database schema
72- =======================
74+ Run application tests
75+ =====================
76+
77+ To help maintainers, we are in the process of adding tests to check the
78+ application has still the expected behaviour.
7379
74- In case you need to inspect the database, you need a second terminal
75- and run:
80+ To get help about writing tests, see the
81+ [ Ruby on Rails documentation] ( https://guides.rubyonrails.org/testing.html#the-rails-test-runner )
82+ .
7683
77- ` docker-compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails `
84+ To run tests with Docker environment, you need to use this command:
7885
79- By default, the requested password is the same as the username.
86+ ```
87+ docker compose exec linuxfr.org bin/rails test -v
88+ ```
89+
90+ Inspect the database schema
91+ ===========================
92+
93+ In case you need to inspect the database, the port ` 3306 ` of your machine is
94+ by default bound to the port ` 3306 ` of the database container.
95+
96+ Thus you can connect to the linuxfr database with hostname ` localhost ` and the
97+ username, password and database name defined in the ` deployment/default.env `
98+ configuration file (all three last are by default ` linuxfr_rails ` ).
8099
81100Apply database migrations
82101=========================
83102
84103In case you need to apply new database migrations, you need a second
85104terminal and run:
86105
87- ` docker-compose run linuxfr.org bin/rails db:migrate `
106+ ```
107+ docker compose exec linuxfr.org bin/rails db:migrate
108+ ```
88109
89110If you had issue and want to reset all data in your database system,
90111use:
91112
92- ` docker-compose run linuxfr.org bin/rails db:reset `
113+ ```
114+ docker compose exec linuxfr.org bin/rails db:reset
115+ ```
93116
94- Services provided by the docker- compose
117+ Services provided by the docker compose
95118=======================================
96119
97- Currently, these services are directly enabled by docker- compose:
120+ Currently, these services are directly enabled by docker compose:
98121
991221 . The [ LinuxFr.org] ( https://github.com/linuxfrorg/linuxfr.org )
100123ruby on rails application itself
@@ -111,7 +134,7 @@ For now, these services aren't available:
111134because it requires to run
112135LinuxFr.org with a TLS certificate. When the service will accept to
113136fetch articles with simple ` http:// ` , we'll be able to provide it
114- directly with docker- compose.
137+ directly with docker compose.
1151382 . The [ svgtex service] ( https://github.com/linuxfrorg/svgtex ) , because LinuxFr
116139has hard-coded the ` localhost `
117140hostname in it's [ HTML Pipeline tool] ( https://github.com/linuxfrorg/html-pipeline-linuxfr/blob/linuxfr/lib/html/pipeline/linuxfr.rb#L8 )
0 commit comments