diff options
-rw-r--r-- | .github/CONTRIBUTING.md | 32 | ||||
-rw-r--r-- | app/DoctrineMigrations/Version20190619093534.php | 65 | ||||
-rw-r--r-- | docker-compose.yml | 20 | ||||
-rw-r--r-- | docker/php/Dockerfile | 23 |
4 files changed, 125 insertions, 15 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 920f1905..d5599206 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md | |||
@@ -1,11 +1,41 @@ | |||
1 | # How to contribute | 1 | # How to contribute |
2 | 2 | ||
3 | ## Test it locally | ||
4 | |||
5 | ### Using Docker | ||
6 | |||
7 | - Clone the repository | ||
8 | - Ensure your Docker daemon is running | ||
9 | - Launch `docker-compose up` | ||
10 | |||
11 | You'll then have: | ||
12 | - a web server (nginx) | ||
13 | - a PHP daemon (using FPM) | ||
14 | - a Redis database (to handle imports) | ||
15 | - a SQLite database to store articles | ||
16 | |||
17 | You can now access your wallabag instance using that url: `http://127.0.0.1:8000` | ||
18 | |||
19 | If you want to test using an other database than SQLite, uncomment the `postgres` or `mariadb` code from the `docker-compose.yml` file at the root of the repo. Also uncomment related line in the `php` section so the database will be linked to your PHP instance. | ||
20 | |||
21 | ### Using your own PHP server | ||
22 | |||
23 | - Ensure you are running PHP > 7.1. | ||
24 | - Clone the repository | ||
25 | - Launch `composer install` | ||
26 | - If you got some errors, fix them (they might be related to some missing PHP extension from your machine) | ||
27 | - Then `php bin/console wallabag:install` | ||
28 | - If you got some errors, fix them (they might be related to some missing PHP extension from your machine) | ||
29 | - Run `php bin/console server:run` | ||
30 | |||
31 | You can now access your wallabag instance using that url: `http://127.0.0.1:8000` | ||
32 | |||
3 | ## You found a bug | 33 | ## You found a bug |
4 | Please [open a new issue](https://github.com/wallabag/wallabag/issues/new). | 34 | Please [open a new issue](https://github.com/wallabag/wallabag/issues/new). |
5 | 35 | ||
6 | To fix the bug quickly, we need some infos: please answer to the questions in the issue form. | 36 | To fix the bug quickly, we need some infos: please answer to the questions in the issue form. |
7 | 37 | ||
8 | If you have the skills, look for errors into php, server and application (see `var/logs`) logs. | 38 | If you have the skills, look for errors into PHP, server and application logs (see `var/logs`). |
9 | 39 | ||
10 | Note : If you have large portions of text, use [Github's Gist service](https://gist.github.com/) or other pastebin-like. | 40 | Note : If you have large portions of text, use [Github's Gist service](https://gist.github.com/) or other pastebin-like. |
11 | 41 | ||
diff --git a/app/DoctrineMigrations/Version20190619093534.php b/app/DoctrineMigrations/Version20190619093534.php new file mode 100644 index 00000000..e9744f1b --- /dev/null +++ b/app/DoctrineMigrations/Version20190619093534.php | |||
@@ -0,0 +1,65 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Application\Migrations; | ||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; | ||
6 | use Wallabag\CoreBundle\Doctrine\WallabagMigration; | ||
7 | |||
8 | /** | ||
9 | * Change reading_time field on SQLite to be integer NOT NULL | ||
10 | * It was forgotten in a previous migration (Version20171008195606.php). | ||
11 | */ | ||
12 | final class Version20190619093534 extends WallabagMigration | ||
13 | { | ||
14 | public function up(Schema $schema): void | ||
15 | { | ||
16 | // this up() migration is auto-generated, please modify it to your needs | ||
17 | $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); | ||
18 | |||
19 | $this->addSql('UPDATE ' . $this->getTable('entry', true) . ' SET reading_time = 0 WHERE reading_time IS NULL;'); | ||
20 | |||
21 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
22 | $this->addSql('DROP INDEX IDX_entry_uid'); | ||
23 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
24 | $this->addSql('DROP INDEX IDX_entry_created_at'); | ||
25 | $this->addSql('DROP INDEX IDX_entry_starred'); | ||
26 | $this->addSql('DROP INDEX IDX_entry_archived'); | ||
27 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
28 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM ' . $this->getTable('entry', true) . ''); | ||
29 | $this->addSql('DROP TABLE ' . $this->getTable('entry', true) . ''); | ||
30 | $this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array) | ||
31 | , headers CLOB DEFAULT NULL --(DC2Type:array) | ||
32 | , hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); | ||
33 | $this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM __temp__' . $this->getTable('entry', true) . ''); | ||
34 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); | ||
35 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)'); | ||
36 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)'); | ||
37 | $this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)'); | ||
38 | $this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)'); | ||
39 | $this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)'); | ||
40 | } | ||
41 | |||
42 | public function down(Schema $schema): void | ||
43 | { | ||
44 | // this down() migration is auto-generated, please modify it to your needs | ||
45 | $this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.'); | ||
46 | |||
47 | $this->addSql('DROP INDEX IDX_F4D18282A76ED395'); | ||
48 | $this->addSql('DROP INDEX created_at'); | ||
49 | $this->addSql('DROP INDEX uid'); | ||
50 | $this->addSql('DROP INDEX hashed_url_user_id'); | ||
51 | $this->addSql('DROP INDEX hashed_given_url_user_id'); | ||
52 | $this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM "' . $this->getTable('entry', true) . '"'); | ||
53 | $this->addSql('DROP TABLE "' . $this->getTable('entry', true) . '"'); | ||
54 | $this->addSql('CREATE TABLE "' . $this->getTable('entry', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, hashed_url CLOB DEFAULT NULL COLLATE BINARY, hashed_given_url CLOB DEFAULT NULL COLLATE BINARY, published_by CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, headers CLOB DEFAULT NULL COLLATE BINARY)'); | ||
55 | $this->addSql('INSERT INTO "' . $this->getTable('entry', true) . '" (id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers) SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM __temp__' . $this->getTable('entry', true) . ''); | ||
56 | $this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . ''); | ||
57 | $this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON "' . $this->getTable('entry', true) . '" (user_id)'); | ||
58 | $this->addSql('CREATE INDEX hashed_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_url)'); | ||
59 | $this->addSql('CREATE INDEX hashed_given_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_given_url)'); | ||
60 | $this->addSql('CREATE INDEX IDX_entry_starred ON "' . $this->getTable('entry', true) . '" (is_starred)'); | ||
61 | $this->addSql('CREATE INDEX IDX_entry_archived ON "' . $this->getTable('entry', true) . '" (is_archived)'); | ||
62 | $this->addSql('CREATE INDEX IDX_entry_uid ON "' . $this->getTable('entry', true) . '" (uid)'); | ||
63 | $this->addSql('CREATE INDEX IDX_entry_created_at ON "' . $this->getTable('entry', true) . '" (created_at)'); | ||
64 | } | ||
65 | } | ||
diff --git a/docker-compose.yml b/docker-compose.yml index 3c28f2f1..0f8f0970 100644 --- a/docker-compose.yml +++ b/docker-compose.yml | |||
@@ -1,9 +1,9 @@ | |||
1 | version: '2' | 1 | version: '2' |
2 | services: | 2 | services: |
3 | nginx: | 3 | nginx: |
4 | image: nginx | 4 | image: nginx:alpine |
5 | ports: | 5 | ports: |
6 | - "8080:80" | 6 | - "8000:80" |
7 | volumes: | 7 | volumes: |
8 | - ./docker/nginx/nginx.conf:/nginx.conf | 8 | - ./docker/nginx/nginx.conf:/nginx.conf |
9 | - ./docker/logs/nginx:/var/log/nginx | 9 | - ./docker/logs/nginx:/var/log/nginx |
@@ -32,8 +32,8 @@ services: | |||
32 | # - ./docker/postgres/env | 32 | # - ./docker/postgres/env |
33 | # - ./docker/mariadb/env | 33 | # - ./docker/mariadb/env |
34 | 34 | ||
35 | #postgres: | 35 | # postgres: |
36 | # image: postgres:9 | 36 | # image: postgres:11-alpine |
37 | # ports: | 37 | # ports: |
38 | # - "5432:5432" | 38 | # - "5432:5432" |
39 | # volumes: | 39 | # volumes: |
@@ -41,7 +41,7 @@ services: | |||
41 | # env_file: | 41 | # env_file: |
42 | # - ./docker/postgres/env | 42 | # - ./docker/postgres/env |
43 | 43 | ||
44 | #mariadb: | 44 | # mariadb: |
45 | # image: mariadb:10 | 45 | # image: mariadb:10 |
46 | # ports: | 46 | # ports: |
47 | # - "3306:3306" | 47 | # - "3306:3306" |
@@ -50,12 +50,12 @@ services: | |||
50 | # env_file: | 50 | # env_file: |
51 | # - ./docker/mariadb/env | 51 | # - ./docker/mariadb/env |
52 | 52 | ||
53 | rabbitmq: | 53 | # rabbitmq: |
54 | image: rabbitmq:3-management | 54 | # image: rabbitmq:3-management-alpine |
55 | ports: | 55 | # ports: |
56 | - "15672:15672" | 56 | # - "15672:15672" |
57 | 57 | ||
58 | redis: | 58 | redis: |
59 | image: redis | 59 | image: redis:4-alpine |
60 | ports: | 60 | ports: |
61 | - "6379:6379" | 61 | - "6379:6379" |
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index b632cb8a..d9b2e5cc 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile | |||
@@ -4,10 +4,25 @@ FROM php:7.2-fpm | |||
4 | ARG timezone='Europe/Paris' | 4 | ARG timezone='Europe/Paris' |
5 | 5 | ||
6 | RUN apt-get update && apt-get install -y \ | 6 | RUN apt-get update && apt-get install -y \ |
7 | libmcrypt-dev libicu-dev libpq-dev libxml2-dev libpng-dev libjpeg-dev \ | 7 | libmcrypt-dev \ |
8 | && /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/include \ | 8 | libicu-dev \ |
9 | && docker-php-ext-install \ | 9 | libpq-dev \ |
10 | iconv mbstring intl pdo pdo_mysql pdo_pgsql gd | 10 | libxml2-dev \ |
11 | libpng-dev \ | ||
12 | libjpeg-dev \ | ||
13 | libsqlite3-dev \ | ||
14 | imagemagick \ | ||
15 | libmagickwand-dev | ||
16 | RUN docker-php-ext-install \ | ||
17 | iconv \ | ||
18 | mbstring \ | ||
19 | intl \ | ||
20 | pdo \ | ||
21 | pdo_mysql \ | ||
22 | pdo_pgsql \ | ||
23 | pdo_sqlite | ||
24 | |||
25 | RUN printf "\n" | pecl install imagick && docker-php-ext-enable imagick | ||
11 | 26 | ||
12 | RUN echo "date.timezone="$timezone > /usr/local/etc/php/conf.d/date_timezone.ini | 27 | RUN echo "date.timezone="$timezone > /usr/local/etc/php/conf.d/date_timezone.ini |
13 | 28 | ||