Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Prochaine version de LinuxFr avec Rails7 #383

Draft
wants to merge 70 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
727130c
Suppression des inline/dataURI de certains boutons.
echarp Sep 15, 2023
316a449
Migration de state_machine à state_machines-activerecord, qui est
echarp Sep 15, 2023
ce52b5d
Mise à jour vers redis 4.8, nouvelle méthode #exists? à la place de e…
echarp Sep 16, 2023
dd25762
belongs_to est par défaut "not nullable" (depuis rails 5)
echarp Sep 16, 2023
8515b71
Complétion de clauses "group by" SQL pour fonctionner sur mysql standard
echarp Sep 17, 2023
2cc2a4b
image_tag a besoin d'un chemin plus complet
echarp Sep 17, 2023
ce67feb
Mécanisme de résolution standard pour templates rédaction/modération
echarp Sep 18, 2023
48e9b0e
Deux nouveaux templates pour gérer les téléchargements markdown depuis
echarp Sep 18, 2023
42db389
Migration à rails 6.1
echarp Sep 18, 2023
bdb9531
Migration initiale vers rails 7, avec gemmes locales et quelques page…
echarp Sep 18, 2023
1a6fded
La méthode #to_s des dates et heures renommée en #to_fs
echarp Sep 18, 2023
515b5e2
La gemme nio4r n'a plus besoin d'être bloquée à une anciennce version
echarp Sep 19, 2023
39b30a4
Mise à jour vers les sous-projets github
echarp Sep 20, 2023
c28adf7
Mise à jour à redis v5
echarp Sep 20, 2023
23ef6e3
Dépréciation de méthode File.exists?
echarp Sep 23, 2023
019835c
Depuis rails 6 il est recommandé d'hériter d'une classe centrale géré…
echarp Sep 26, 2023
a09b930
Ajout de tests, surtout sur les contrôleurs de premier niveau,
echarp Sep 27, 2023
826132d
Déplacement de journal vers forum fonctionnel à nouveau
echarp Sep 29, 2023
be855c0
Plus de tests d'intégration, pour 90% de couverture
echarp Sep 29, 2023
7fa74ea
Chemin manquant pour accéder à des "partials" de news en modération
echarp Sep 30, 2023
acc0e53
La pluralisation nécessite un helper pour afficher le nombre
echarp Sep 30, 2023
9088fbc
L'API des errors a évolué, l'ancienne méthode "values" est dépréciée
echarp Sep 30, 2023
dd5d637
La mise à jour de la gemme doorkeeper nécessite une migration BdD
echarp Oct 1, 2023
8505f8c
MaJ script schéma BdD
echarp Oct 1, 2023
279c4c8
Plus de tests, pour une couverture à 95%
echarp Oct 1, 2023
d9c99dd
Tous les contrôleurs admin sont testés, à 100%
echarp Oct 2, 2023
46f285a
Rapide correction, pour pouvoir lister les suivis non assignés
echarp Oct 2, 2023
a7413f1
Chemin manquant pour accéder à un "partials" de comment
echarp Oct 2, 2023
ab5cfc6
Plus de tests, les contrôleurs sont testés à plus de 99%
echarp Oct 2, 2023
07d542d
Test des threads de commentaires
echarp Oct 3, 2023
133309e
Un peu plus de tests de models
echarp Oct 3, 2023
b2d31ef
La redirection vers duck duck go nécessite une permission explicite p…
echarp Oct 3, 2023
db8a207
Utilisation du serveur web par défaut des derniers rails: puma
echarp Oct 4, 2023
b3ce99c
Tests de contrôleurs à peu près completes, et propres
echarp Oct 4, 2023
42e20fb
Utilisation de Redis.new plutôt que de la variable globale $redis dan…
echarp Oct 4, 2023
9c3fcc2
Utilisation de Redis.new dans les tests de modèle aussi
echarp Oct 4, 2023
7a4c255
L'action "move" des liens n'existe pas
echarp Oct 10, 2023
c2786fd
Migration à rails 7.1
echarp Oct 10, 2023
fed76ca
Oubli configuration pour avoir des boutons sous forme de liens
echarp Oct 10, 2023
00a51fa
Test plus solide, et utilisation de double quote à certains endroits
echarp Oct 10, 2023
f6d205f
Utilisation de la gem normalize, plutôt qu'un module npm
echarp Oct 16, 2023
32aac6a
Suppression de node et npm
echarp Oct 16, 2023
4dfa299
Suppression de références à node_modules
echarp Oct 16, 2023
7088bfa
Migration à rails 7.1.1
echarp Oct 16, 2023
ee3ba80
Nettoyage Gemfile
echarp Oct 17, 2023
819532c
Remove CoffeeScript, use plain Javascript instead
nud Aug 20, 2023
bef47be
Apply remarks from decaffeinate to the new javascript files
nud Dec 21, 2023
11eef3c
Fix scrolling to the bottom of the page when using shift+g
nud Dec 21, 2023
676b4c7
Update nginx config and docker files to use Debian Bookworm with Ruby…
Trim Mar 24, 2024
de0b87e
Add note to enable the DOCKER_BUILDKIT builder
Trim Oct 9, 2023
67e668b
explain how to run linuxfr with rootless containers
Trim Dec 19, 2023
2f5742a
use container engine agnostic file names as it works with Docker and …
Trim Mar 8, 2024
c07d7a5
Bundle update
echarp Mar 10, 2024
d659977
Upgrade unicorn, carrierwave and acts_as_list, remove coffee gem
echarp Mar 10, 2024
ed5b4ee
update linuxfr-board container to use the board-sse-linuxfr.org gem v…
Trim Mar 22, 2024
ee9cf0c
add to Container.md podman compose run, add IFS value for database en…
Trim Mar 22, 2024
5875aff
URI.encode has been removed from Ruby 3
Trim Mar 23, 2024
9ae0b64
linuxfr-img container can use bookworm to build the Go service
Trim Mar 24, 2024
c861fcd
Add nodejs back to linuxfr.org container which is used to uglify java…
Trim Mar 24, 2024
a36e960
compose: share gemfile from host
Trim Mar 26, 2024
07a1f9f
replace uglifier gem by terser to minimize javascript files
Trim Mar 27, 2024
61d93f1
Bundle update (removes a small CVE)
echarp Apr 1, 2024
b5ec6af
Passage à Haml 6+
echarp Apr 1, 2024
750b438
Passage to Sass 6+
echarp Apr 1, 2024
e718ec1
Merge pull request #391 from echarp/rails7
Trim Apr 14, 2024
a8b3b53
feat: Update gem dependencies and sitemap generator
echarp Jun 9, 2024
826fdcb
Merge pull request #393 from echarp/rails7
Trim Sep 19, 2024
a0085c9
fix typos
Trim Sep 19, 2024
08d1dd3
use custom HTTP public port to use rootless containers by default
Trim Sep 20, 2024
f9f0de0
Merge pull request #395 from Trim/configurable-public-port
Trim Sep 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
/uploads
/vendor/ruby
/vendor/bundle
/coverage
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
/vendor/bundle
/.env
/docker-compose.*.yaml
.rubocop.yml
Guardfile
coverage
2 changes: 0 additions & 2 deletions Capfile

This file was deleted.

83 changes: 51 additions & 32 deletions Docker.md → Container.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,57 @@
LinuxFr on Docker
-----------------
LinuxFr with Containers
-----------------------

To simplify set up of a developement environment, LinuxFr.org can be
run on Docker with `docker compose up`.
To simplify set up of a development environment, LinuxFr.org can be
run with a container engine like Docker or Podman with the [`compose.yml`](./compose.yaml)
file which describes how to build all needed services.

To init the SQL database schema, you need to wait upto the `database`
container to be ready to listen MySQL connections.
By default, the LinuxFr.org services will be provided under the domain names
`dlfp.lo` and `image.dlfp.lo`. So you'll need to add the
following line into the `/etc/hosts` file of your machine:

```
127.0.0.1 dlfp.lo image.dlfp.lo
```

Then, if you use the Docker engine, you can use the `docker compose up`
command to start the system (you need to install the
[Docker compose plugin](https://docs.docker.com/compose/) first).

> Note: with the Docker engine, you need to enable the Docker BuildKit builder.
> Either you have a Docker version which uses it by default, or you set the
> environment variable `export DOCKER_BUILDKIT=1`.

If you use the Podman engine, you can either use the same Docker compose plugin
or the [podman-compose](https://github.com/containers/podman-compose/)
tool. The podman cli itself provides a wrapper of one of these two tools
through the
[`podman compose` command](https://docs.podman.io/en/latest/markdown/podman-compose.1.html).
Thus you need to use the `podman compose up` command to start the system.

At this point, this documentation will give you `docker compose` commands,
but you should be able to use `podman compose` without any issue.

To setup the SQL database schema, you need to wait until the `database`
container becomes ready to listen MySQL connections.

For example, you should see in the logs:

> database_1 | 2020-09-21 16:03:12 139820938893312 [Note] mysqld: ready for connections.
> database_1 | 2020-09-21 16:03:12 139820938893312 [Note] *mysqld: ready for connections.*
>
> database_1 | Version: '10.1.46-MariaDB-1\~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution

Or you can check the `database` container status to be "healthy".
Or you can check the `database` container status to be *healthy* with the
`docker compose ps` command.

Then, open a second terminal and run:

```
docker compose exec linuxfr.org bin/rails db:setup
```

Finally, the environment is ready and you can open [http://dlfp.lo](http://dlfp.lo)
Finally, the environment is ready and you can open [http://dlfp.lo:9000](http://dlfp.lo:9000)
in your favorite browser.

Note: to be able to access this URL, you'll need to add the following line
into the `/etc/hosts` file of your machine:

```
127.0.0.1 dlfp.lo image.dlfp.lo
```

Personalize configuration
=========================

Expand All @@ -40,24 +61,22 @@ If you want, you can change the domain names used by the LinuxFr.org
web application. To do this, you can setup `DOMAIN` and `IMAGE_DOMAIN`
variables in the `deployment/default.env` file.

You can also configure your own Redis service and your own MySQL
service.

If you want to change the application port and/or other configurations, you can
[override](https://docs.docker.com/compose/extends/)
the docker compose configuration (in particular the `nginx` service for
the port).
Within the same file, you can update the HTTP listening ports by updating the
`DOMAIN_HTTP_PORT` and `IMAGE_DOMAIN_HTTP_PORT` variables (both are set to
`9000` by default). If you modify them, don't forget to add the new values as
published ports for the `nginx` service in the `compose.yaml` file (they have
to target the `8080` container port).

Notice, that if LinuxFr.org doesn't run on port 80, the image cache
service won't work well and so you won't be able to see images in the news.
You can also configure your own Redis service and your own MySQL
service by updating environment variables in the same file.

Test modifications
==================

The docker compose is currently configured to share `./app`, `./db` and
`./public` directories with the docker container.
The compose file currently shares `./app`, `./db` and
`./public` directories with the container.

So you can update files with your prefered IDE on your machine. Rails
So you can update files with your preferred IDE on your machine. Rails
will directly detect changes and apply them on next page reload.

Furthermore, if you need to access the Rails console, you need a second
Expand All @@ -75,13 +94,13 @@ Run application tests
=====================

To help maintainers, we are in the process of adding tests to check the
application has still the expected behaviour.
application has still the expected behavior.

To get help about writing tests, see the
[Ruby on Rails documentation](https://guides.rubyonrails.org/testing.html#the-rails-test-runner)
.

To run tests with Docker environment, you need to use this command:
To run tests with containers, you need to use this command:

```
docker compose exec linuxfr.org bin/rails test -v
Expand Down Expand Up @@ -114,10 +133,10 @@ use:
docker compose exec linuxfr.org bin/rails db:reset
```

Services provided by the docker compose
Services provided by the compose file
=======================================

Currently, these services are directly enabled by docker compose:
Currently, these services are directly enabled by compose:

1. The [LinuxFr.org](https://github.com/linuxfrorg/linuxfr.org)
ruby on rails application itself
Expand Down
50 changes: 20 additions & 30 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
source 'https://rubygems.org'
source "https://rubygems.org"

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end

gem "rails", "~>5.2"
gem "nio4r", "2.5.2" # 2.5.3 is not compatible with ruby 2.3
gem "rails", "~>7.1"

gem "actionpack-page_caching", github: "linuxfrorg/actionpack-page_caching"
gem "actionpack-page_caching"
gem "acts_as_list", "~>1.1"
gem "ansi", "~>1.4", require: false
gem "acts_as_list", "~>0.4"
gem "bitfields", "~>0.4"
gem "bootsnap", "~>1.3", require: false
gem "canable", "~>0.1"
gem "carrierwave", "~>1.1"
gem "carrierwave", "~>3.0"
gem "devise", "~>4.3"
gem "diff_match_patch", github: "nono/diff_match_patch-ruby", require: "diff_match_patch"
gem "doorkeeper", "~>4.2"
gem "doorkeeper"
gem "ffi-hunspell", github: "postmodern/ffi-hunspell"
gem "french_rails", "~>0.4"
gem "french_rails", "~>0.5", github: "linuxfrorg/french-rails"
gem "friendly_id", "~>5.1"
gem "haml", "~>5.0"
gem "html-pipeline-linuxfr", "~>0.15"
gem "haml", "~>6.3"
gem "htmlentities", "~>4.3"
gem "html-pipeline-linuxfr", "~>0.17", github: "linuxfrorg/html-pipeline-linuxfr"
gem "html_spellchecker", "~>0.1"
gem "html_truncator", "~>0.4"
gem "htmlentities", "~>4.3"
gem "inherited_resources", "~>1.8"
gem "kaminari", "~>1.2"
gem "mini_magick", "~>4.9"
gem "mysql2", "~>0.5.0"
gem "nokogiri", "~>1.10"
gem "redis", "~>5.0"
gem "rinku", "~>2.0"
gem "redis", "~>4.0"
gem "sitemap_generator", "~>2.1"
gem "state_machine", "~>1.2"
gem "sitemap_generator"
gem "state_machines-activerecord"

# Gems used for assets
assets = !%w(production alpha).include?(ENV['RAILS_ENV'])
assets = true if ENV['RAILS_GROUPS'] == "assets"
gem "jquery-rails", "~>4.0", require: assets
gem "coffee-rails", "~>4.1", require: assets
gem "sass-rails", "~>5.0", require: assets
gem "rails-sass-images", require: assets
gem "uglifier", require: assets
gem "jquery-rails", "~>4.0", require: assets
gem "normalize-rails", "~>8.0", require: assets
gem "sassc-rails", require: assets
gem "terser", "~> 1.2", require: assets

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
Expand All @@ -54,25 +52,17 @@ group :development do
gem "annotate"
gem "better_errors"
gem "binding_of_caller"
gem "capistrano", "~>2.15", github: 'capistrano', branch: 'legacy-v2'
gem "capistrano-maintenance"
gem "letter_opener"
gem "listen", github: "guard/listen"
gem "mo"
gem "pry-rails"
gem "puma"
gem "spring"
gem "sushi"
gem "thin"
gem "web-console"
end

group :test do
# Adds support for Capybara system testing and selenium driver
gem "capybara", ">= 2.15"
gem "selenium-webdriver"
gem "simplecov"
end

group :production, :alpha do
gem "unicorn", "~>5.1"
gem "gctools", "~>0.2"
gem "unicorn", "~>6.1"
end
Loading