1
0
mirror of https://github.com/wallabag/docker synced 2025-12-13 17:56:31 +00:00

15 Commits
2.0.7 ... 2.0.8

Author SHA1 Message Date
Nicolas Lœuillet
cccc5fb91e Merge pull request #17 from wallabag/wllbg-208
wallabag 2.0.8
2016-09-07 15:36:33 +02:00
Nicolas Lœuillet
79ae48bfac wallabag 2.0.8 2016-09-07 14:38:00 +02:00
xsteadfastx
d0691598b6 Merge pull request #16 from xsteadfastx/master
Login testing works now
2016-09-02 10:24:10 +02:00
Marvin Steadfast
28b4b03b21 readme: added badges 2016-09-01 12:04:11 +02:00
Marvin Steadfast
c65be008ec tests: some pep8 and real failing if csrf dont match 2016-09-01 09:33:17 +02:00
xsteadfastx
63ee463365 Merge pull request #1 from Strubbl/test_login
test_login: add login with csrf token and check if it was successful
2016-09-01 09:15:18 +02:00
Sven Fischer
efbcf75701 test_login: add login with csrf token and check if it was successful 2016-08-31 23:13:32 +02:00
Marvin Steadfast
b4b1469215 try to test login
i use requests to test login. the session should be saved and this
should work. but i get a error that th session expired. to run this
start wallabag and run it with pytest: `py.test -s tests/`. it will
output the html of the response.
2016-08-31 16:38:13 +02:00
Marvin Steadfast
4a81bc45db added travis testing
travis builds and spins up containers for sqlite, mariadb and postgres
and runs a simple python test script for accessing the wallabag.
2016-08-29 13:51:14 +02:00
Jeremy Benoist
107beb115c Merge pull request #14 from mmounirou/feature/allow-db-root-user-config
allow overwrite of the root postgres username
2016-08-25 11:02:11 +02:00
Mohamed MOUNIROU
67030c1c36 remove an unnecessary white space 2016-08-25 10:23:31 +02:00
Mohamed MOUNIROU
255fe53dfc set the default value for POSTGRES_USER to postgres
This is done in order to ensure backward compatibility
2016-08-24 18:28:34 +02:00
Mohamed MOUNIROU
4094d3c9ff give the ability to change postgres root user
This can be acheived by setting the environment variable POSTGRES_USER
2016-08-24 18:25:03 +02:00
Jeremy Benoist
93651c95f5 Fix bad SQLite title
and update few others titles
2016-08-24 15:17:36 +02:00
Marvin Steadfast
97783ac312 fixed README 2016-08-24 12:33:22 +02:00
9 changed files with 160 additions and 13 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.cache
__pycache__/*
*.pyc

25
.travis.yml Normal file
View File

@@ -0,0 +1,25 @@
language: python
python:
- 3.5
services:
- docker
env:
- DB_TYPE=sqlite
- DB_TYPE=mariadb
- DB_TYPE=postgresql
install:
- docker-compose -f tests/docker-compose.$DB_TYPE.yml build
- docker-compose -f tests/docker-compose.$DB_TYPE.yml up -d
before_script:
- pip install pytest
- pip install requests
script:
- docker ps | grep -q wallabag
- sleep 60
- py.test tests/

View File

@@ -1,13 +1,14 @@
FROM alpine:edge FROM alpine:edge
MAINTAINER Marvin Steadfast <marvin@xsteadfastx.org> MAINTAINER Marvin Steadfast <marvin@xsteadfastx.org>
ENV WALLABAG_VERSION=2.0.7 \ ENV WALLABAG_VERSION=2.0.8 \
SYMFONY__ENV__DATABASE_DRIVER=pdo_sqlite \ SYMFONY__ENV__DATABASE_DRIVER=pdo_sqlite \
SYMFONY__ENV__DATABASE_HOST=127.0.0.1 \ SYMFONY__ENV__DATABASE_HOST=127.0.0.1 \
SYMFONY__ENV__DATABASE_PORT=~ \ SYMFONY__ENV__DATABASE_PORT=~ \
SYMFONY__ENV__DATABASE_NAME=symfony \ SYMFONY__ENV__DATABASE_NAME=symfony \
SYMFONY__ENV__DATABASE_USER=root \ SYMFONY__ENV__DATABASE_USER=root \
SYMFONY__ENV__DATABASE_PASSWORD=~ \ SYMFONY__ENV__DATABASE_PASSWORD=~ \
POSTGRES_USER=postgres \
SYMFONY__ENV__SECRET=ovmpmAWXRCabNlMgzlzFXDYmCFfzGv \ SYMFONY__ENV__SECRET=ovmpmAWXRCabNlMgzlzFXDYmCFfzGv \
SYMFONY__ENV__MAILER_HOST=127.0.0.1 \ SYMFONY__ENV__MAILER_HOST=127.0.0.1 \
SYMFONY__ENV__MAILER_USER=~ \ SYMFONY__ENV__MAILER_USER=~ \

View File

@@ -1,5 +1,9 @@
# What is wallabag? # What is wallabag?
[![Build Status](https://travis-ci.org/wallabag/docker.svg?branch=master)](https://travis-ci.org/wallabag/docker)
[![Docker Stars](https://img.shields.io/docker/stars/wallabag/wallabag.svg?maxAge=2592000)](https://hub.docker.com/r/wallabag/wallabag/)
[![Docker Pulls](https://img.shields.io/docker/pulls/wallabag/wallabag.svg?maxAge=2592000)](https://hub.docker.com/r/wallabag/wallabag/)
[wallabag](https://www.wallabag.org/) is a self hostable application for saving web pages. Unlike other services, wallabag is free (as in freedom) and open source. [wallabag](https://www.wallabag.org/) is a self hostable application for saving web pages. Unlike other services, wallabag is free (as in freedom) and open source.
With this application you will not miss content anymore. Click, save, read it when you want. It saves the content you select so that you can read it when you have time. With this application you will not miss content anymore. Click, save, read it when you want. It saves the content you select so that you can read it when you have time.
@@ -12,6 +16,7 @@ Default login is `wallabag:wallabag`.
- `-e MYSQL_ROOT_PASSWORD=...` (needed for the mariadb container to initialise and for the entrypoint in the wallabag container to create a database and user if its not there) - `-e MYSQL_ROOT_PASSWORD=...` (needed for the mariadb container to initialise and for the entrypoint in the wallabag container to create a database and user if its not there)
- `-e POSTGRES_PASSWORD=...` (needed for the posgres container to initialise and for the entrypoint in the wallabag container to create a database and user if not there) - `-e POSTGRES_PASSWORD=...` (needed for the posgres container to initialise and for the entrypoint in the wallabag container to create a database and user if not there)
- `-e POSTGRES_USER=...` (needed for the posgres container to initialise and for the entrypoint in the wallabag container to create a database and user if not there)
- `-e SYMFONY__ENV__DATABASE_DRIVER=...` (defaults to "pdo_sqlite", this sets the database driver to use) - `-e SYMFONY__ENV__DATABASE_DRIVER=...` (defaults to "pdo_sqlite", this sets the database driver to use)
- `-e SYMFONY__ENV__DATABASE_HOST=...` (defaults to "127.0.0.1", if use mysql this should be the name of the mariadb container) - `-e SYMFONY__ENV__DATABASE_HOST=...` (defaults to "127.0.0.1", if use mysql this should be the name of the mariadb container)
- `-e SYMFONY__ENV__DATABASE_PORT=...` (port of the database host) - `-e SYMFONY__ENV__DATABASE_PORT=...` (port of the database host)
@@ -23,36 +28,37 @@ Default login is `wallabag:wallabag`.
- `-e SYMFONY__ENV__MAILER_USER=...` (defaults to "~", the SMTP user) - `-e SYMFONY__ENV__MAILER_USER=...` (defaults to "~", the SMTP user)
- `-e SYMFONY__ENV__MAILER_PASSWORD=...`(defaults to "~", the SMTP password) - `-e SYMFONY__ENV__MAILER_PASSWORD=...`(defaults to "~", the SMTP password)
- `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "wallabag@example.com", the address wallabag uses for outgoing emails) - `-e SYMFONY__ENV__FROM_EMAIL=...`(defaults to "wallabag@example.com", the address wallabag uses for outgoing emails)
## sqlite
The easiest way to start wallabag is to use the sqlite backend. You can spin that up with ## SQLite
The easiest way to start wallabag is to use the SQLite backend. You can spin that up with
``` ```
$ docker run -p 80:80 xsteadfastx/wallabag $ docker run -p 80:80 wallabag/wallabag
``` ```
and point your browser to `http://localhost:80`. For persistent storage you should start the container with the a volume: and point your browser to `http://localhost:80`. For persistent storage you should start the container with the a volume:
``` ```
$ docker run -v /opt/wallabag:/var/www/wallabag/data -p 80:80 xsteadfastx/wallabag $ docker run -v /opt/wallabag:/var/www/wallabag/data -p 80:80 wallabag/wallabag
``` ```
## mariadb / mysql ## MariaDB / MySQL
For using mariadb or mysql you have to define some environment variables with the container. Example: For using MariaDB or MySQL you have to define some environment variables with the container. Example:
``` ```
$ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb $ docker run docker run --name wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -d mariadb
$ docker run --name wallabag --link wallabag-db:wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=3306" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag $ docker run --name wallabag --link wallabag-db:wallabag-db -e "MYSQL_ROOT_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=3306" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag
``` ```
## postgresql ## PostgreSQL
For using postgresql you have to define some environment variables with the container. Example: For using PostgreSQL you have to define some environment variables with the container. Example:
``` ```
$ docker run docker run --name wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -d postgres $ docker run docker run --name wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "POSTGRES_USER=my-super-user" -d postgres
$ docker run --name wallabag --link wallabag-db:wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=5432" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag $ docker run --name wallabag --link wallabag-db:wallabag-db -e "POSTGRES_PASSWORD=my-secret-pw" -e "POSTGRES_USER=my-super-user" -e "SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql" -e "SYMFONY__ENV__DATABASE_HOST=wallabag-db" -e "SYMFONY__ENV__DATABASE_PORT=5432" -e "SYMFONY__ENV__DATABASE_NAME=wallabag" -e "SYMFONY__ENV__DATABASE_USER=wallabag" -e "SYMFONY__ENV__DATABASE_PASSWORD=wallapass" -p 80:80 wallabag/wallabag
``` ```
## docker-compose ## docker-compose
@@ -85,6 +91,7 @@ services:
volumes: volumes:
- /opt/wallabag:/var/lib/mysql - /opt/wallabag:/var/lib/mysql
``` ```
Note that you must fill out the mail related variables according to your mail config. Note that you must fill out the mail related variables according to your mail config.
## nginx ## nginx

View File

@@ -10,6 +10,7 @@
database_password: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PASSWORD') }}" database_password: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PASSWORD') }}"
database_port: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PORT') }}" database_port: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_PORT') }}"
database_root_password_mariadb: "{{ lookup('env', 'MYSQL_ROOT_PASSWORD') }}" database_root_password_mariadb: "{{ lookup('env', 'MYSQL_ROOT_PASSWORD') }}"
database_root_user_postgres: "{{ lookup('env', 'POSTGRES_USER') }}"
database_root_password_postgres: "{{ lookup('env', 'POSTGRES_PASSWORD') }}" database_root_password_postgres: "{{ lookup('env', 'POSTGRES_PASSWORD') }}"
database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER') }}" database_user: "{{ lookup('env', 'SYMFONY__ENV__DATABASE_USER') }}"
@@ -75,7 +76,7 @@
state=present state=present
login_host="{{ database_host }}" login_host="{{ database_host }}"
port={{ database_port }} port={{ database_port }}
login_user=postgres login_user="{{ database_root_user_postgres }}"
login_password="{{ database_root_password_postgres }}" login_password="{{ database_root_password_postgres }}"
notify: run install notify: run install
when: database_driver == 'pdo_pgsql' when: database_driver == 'pdo_pgsql'
@@ -88,7 +89,7 @@
priv=ALL priv=ALL
login_host="{{ database_host }}" login_host="{{ database_host }}"
port={{ database_port }} port={{ database_port }}
login_user=postgres login_user="{{ database_root_user_postgres }}"
login_password="{{ database_root_password_postgres }}" login_password="{{ database_root_password_postgres }}"
state=present state=present
when: (database_driver == 'pdo_pgsql') and when: (database_driver == 'pdo_pgsql') and

View File

@@ -0,0 +1,22 @@
version: '2'
services:
wallabag:
build:
context: ../
image: wallabag:mariadb
container_name: wallabag
environment:
- MYSQL_ROOT_PASSWORD=wallaroot
- SYMFONY__ENV__SECRET=F00B4R
- SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
- SYMFONY__ENV__DATABASE_HOST=db
- SYMFONY__ENV__DATABASE_PORT=3306
- SYMFONY__ENV__DATABASE_NAME=wallabag
- SYMFONY__ENV__DATABASE_USER=wallabag
- SYMFONY__ENV__DATABASE_PASSWORD=wallapass
ports:
- "127.0.0.1:80:80"
db:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=wallaroot

View File

@@ -0,0 +1,24 @@
version: '2'
services:
wallabag:
build:
context: ../
image: wallabag:postgresql
container_name: wallabag
environment:
- POSTGRES_PASSWORD=my-secret-pw
- POSTGRES_USER=my-super-user
- SYMFONY__ENV__SECRET=F00B4R
- SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
- SYMFONY__ENV__DATABASE_HOST=db
- SYMFONY__ENV__DATABASE_PORT=5432
- SYMFONY__ENV__DATABASE_NAME=wallabag
- SYMFONY__ENV__DATABASE_USER=wallabag
- SYMFONY__ENV__DATABASE_PASSWORD=wallapass
ports:
- "127.0.0.1:80:80"
db:
image: postgres
environment:
- POSTGRES_PASSWORD=my-secret-pw
- POSTGRES_USER=my-super-user

View File

@@ -0,0 +1,17 @@
version: '2'
services:
wallabag:
build:
context: ../
image: wallabag:sqlite
container_name: wallabag
environment:
- SYMFONY__ENV__DATABASE_DRIVER=pdo_sqlite
- SYMFONY__ENV__DATABASE_HOST=127.0.0.1
- SYMFONY__ENV__DATABASE_PORT=~
- SYMFONY__ENV__DATABASE_NAME=symfony
- SYMFONY__ENV__DATABASE_USER=root
- SYMFONY__ENV_DATABASE_PASSWORD=~
- SYMFONY__ENV__SECRET=F00B4R
ports:
- "127.0.0.1:80:80"

47
tests/test_login.py Normal file
View File

@@ -0,0 +1,47 @@
import pytest
import re
import requests
URL = 'http://127.0.0.1:80'
def test_accessing_login_page():
r = requests.get(URL, allow_redirects=True)
assert r.status_code == 200
assert 'Login' in r.text
assert 'Password' in r.text
assert 'Register' in r.text
assert 'Username' in r.text
def test_logging_in():
client = requests.session()
r = client.get(URL, allow_redirects=True)
jar = r.cookies
# get csrf token
csrf_match = re.search(
'<input type="hidden" name="_csrf_token" value="(.*)" />',
r.text
)
if csrf_match:
csrf = csrf_match.group(1)
else:
# if there is no csrf token the test will fail
pytest.fail('csrf not matched')
data = {
'_username': 'wallabag',
'_password': 'wallabag',
'_csrf_token': csrf
}
r = client.post(URL + '/login_check', cookies=jar, data=data)
assert r.status_code == 200
assert '/unread/list' in r.text
assert '/starred/list' in r.text
assert '/archive/list' in r.text
assert '/all/list' in r.text