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

Docker: switch to Alpine Linux #846

Merged
merged 2 commits into from
Oct 21, 2017
Merged

Conversation

virtualtam
Copy link
Member

@virtualtam virtualtam commented Apr 9, 2017

Closes #843

Changed:

  • switch base image from Debian:Jessie to Alpine:3.6
  • switch to PHP 7.1
  • switch from supervisord to s6 to manage services

Done:

WIP:

  • thorough testing of Shaarli pages and features

See:

@virtualtam virtualtam added this to the 0.9.1 milestone Apr 9, 2017
@virtualtam virtualtam self-assigned this Apr 9, 2017
@nodiscc nodiscc changed the title docker: switch to Alpine Linux WIP: docker: switch to Alpine Linux Apr 13, 2017
@virtualtam
Copy link
Member Author

virtualtam commented May 11, 2017

The main image (docker/production) builds & works, feel free to give it a spin!

There are some quirks highlighted by UTs that I suspect are due to musl-libc behaving a bit differently from glibc, this concerns path concatenation and globbing so far.

@virtualtam virtualtam force-pushed the docker/alpine branch 2 times, most recently from 60fcfd9 to a887a52 Compare July 29, 2017 13:46
@virtualtam virtualtam modified the milestones: 0.9.1, 0.9.2 Aug 3, 2017
@virtualtam virtualtam changed the title WIP: docker: switch to Alpine Linux Docker: switch to Alpine Linux Sep 19, 2017
@virtualtam
Copy link
Member Author

Similar errors from Debian8, Debian9 and Alpine36 (Ubuntu16 is fine):

$ docker run --rm -v $PWD:/shaarli shaarli-test:alpine36 docker_all_tests

rsync -az /shaarli/ ~/shaarli/
cd ~/shaarli && make all_tests
make[1]: Entering directory '/root/shaarli'
-------
PHPUNIT
-------
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

....................................F.F.E..E...................  63 / 397 ( 15%)
............................................................... 126 / 397 ( 31%)
............................................................... 189 / 397 ( 47%)
........F...................................................... 252 / 397 ( 63%)
............................................................... 315 / 397 ( 79%)
............................................................... 378 / 397 ( 95%)
...................

Time: 5.45 seconds, Memory: 27.25MB

There were 2 errors:

1) FileUtilsTest::testReadNotReadable
gzinflate(): data error

/root/shaarli/application/FileUtils.php:70
/root/shaarli/tests/FileUtilsTest.php:105

2) HistoryTest::testConstructNotWritable
gzinflate(): data error

/root/shaarli/application/FileUtils.php:70
/root/shaarli/application/History.php:167
/root/shaarli/application/History.php:83
/root/shaarli/application/History.php:133
/root/shaarli/application/History.php:121
/root/shaarli/tests/HistoryTest.php:51

--

There were 3 failures:

1) FileUtilsTest::testWriteWithoutPermission
Failed asserting that exception of type "IOException" is thrown.

2) FileUtilsTest::testWriteFolderPermission
Failed asserting that exception of type "IOException" is thrown.

3) UpdaterTest::testWriteUpdatesFileNotWritable
Failed asserting that exception of type "Exception" is thrown.

FAILURES!
Tests: 397, Assertions: 1449, Errors: 2, Failures: 3.

Generating code coverage report in PHP format ... done
Makefile:134: recipe for target 'test' failed
make[1]: Leaving directory '/root/shaarli'
make[1]: *** [test] Error 2
Makefile:28: recipe for target 'docker_all_tests' failed
make: *** [docker_all_tests] Error 2

@virtualtam
Copy link
Member Author

The gzinflate errors happen on some platforms when attempting to inflate (decompress) archives that are actually empty (as in "empty file"). I don't know why this behaviour differs from Debian to Ubuntu, though.

This can be avoided by improving the robustness of FileUtils by adding a preliminary check, I'll submit the corresponding PR :)

Related (?) resources:

virtualtam added a commit to virtualtam/Shaarli that referenced this pull request Sep 28, 2017
Relates to shaarli#846

PHP's `gzinflate()` fails with an error when being passed an empty string

See:
- https://bugs.php.net/bug.php?id=71395

Signed-off-by: VirtualTam <[email protected]>
virtualtam added a commit to virtualtam/Shaarli that referenced this pull request Sep 28, 2017
Relates to shaarli#845
Relates to shaarli#846
Relates to shaarli#909

Signed-off-by: VirtualTam <[email protected]>
virtualtam added a commit to virtualtam/Shaarli that referenced this pull request Sep 28, 2017
Relates to shaarli#846

PHP's `gzinflate()` fails with an error when being passed an empty string

See:
- https://bugs.php.net/bug.php?id=71395

Signed-off-by: VirtualTam <[email protected]>
@virtualtam
Copy link
Member Author

PR rebased and in review \o/

Copy link
Member

@nodiscc nodiscc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, will unable to test this in the coming days though. Did you notice a performance increase?

@virtualtam
Copy link
Member Author

No hurry, I'd greatly appreciate usage feedback before merging!

Did you notice a performance increase?

Well, my, lemme check my Shaarli bookmark mining farm...

Images are shrinked to a minimal size, and the memory footprint is significantly smaller.

Here's a rough comparison, using :

  • Docker 17.07.0-ce with the overlay2 storage driver
  • images:
    • shaarli:stable: current image for stable
    • shaarli/shaarli:latest: current image for master
    • shaarli:master: local development image for master (this PR)
  • setup:
    • each instance has ~2500 bookmarks loaded
    • some plugins are enabled: addlink_toolbar, archiveorg, qrcode, playvideos
    • ~500 thumbnails have been loaded by the picwall

Note: output truncated for readability

$ docker images

REPOSITORY       TAG     IMAGE ID      CREATED       SIZE
shaarli          stable  dd0b1834fa93  24 hours ago  318MB
shaarli/shaarli  latest  c3ffba699be1  24 hours ago  293MB
shaarli          master  d24339645fed  24 hours ago  69MB
$ docker ps

CONTAINER ID        IMAGE                    COMMAND
bd4df1fc76ca        shaarli/shaarli:latest   "/usr/bin/supervis..."
cb5a76b665f0        shaarli:stable           "/usr/bin/supervis..."
1a358ebff5cb        shaarli:master           "/bin/s6-svscan /e..."
$ docker stats --no-stream

 CONTAINER     CPU %  MEM USAGE / LIMIT    NET I/O          BLOCK I/O         PIDS
bd4df1fc76ca  0.03%  54.92MiB / 15.62GiB  704kB / 1.79MB   1.87MB / 30.8MB   9
cb5a76b665f0  0.03%  54.25MiB / 15.62GiB  714kB / 1.49MB   32.4MB / 438kB    9
1a358ebff5cb  0.00%  28.89MiB / 15.62GiB  41.8kB / 2.16MB  24.5MB / 69.6kB   11                                                                                                                                                           

@ArthurHoaro ArthurHoaro modified the milestones: 0.9.2, 0.9.3 Oct 7, 2017
@virtualtam virtualtam merged commit 72cfe44 into shaarli:master Oct 21, 2017
@virtualtam virtualtam deleted the docker/alpine branch October 21, 2017 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants