From e5633dae67579f331c3946489386a73b374918ba Mon Sep 17 00:00:00 2001 From: Brian Bouterse Date: Tue, 27 Feb 2018 10:39:50 -0500 Subject: [PATCH 1/2] Switch Pulp to use sqlite3 as default https://pulp.plan.io/issues/3359 closes #3359 --- pulpcore/pulpcore/app/settings.py | 6 +++--- pulpcore/pulpcore/etc/pulp/server.yaml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pulpcore/pulpcore/app/settings.py b/pulpcore/pulpcore/app/settings.py index 26b28fd959..016a564cb7 100644 --- a/pulpcore/pulpcore/app/settings.py +++ b/pulpcore/pulpcore/app/settings.py @@ -168,9 +168,9 @@ # https://docs.djangoproject.com/en/1.8/ref/settings/#databases 'databases': { 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'pulp', - 'USER': 'pulp', + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': '', + 'USER': '', 'CONN_MAX_AGE': 0, }, }, diff --git a/pulpcore/pulpcore/etc/pulp/server.yaml b/pulpcore/pulpcore/etc/pulp/server.yaml index 4b30b0596a..2977bf5119 100644 --- a/pulpcore/pulpcore/etc/pulp/server.yaml +++ b/pulpcore/pulpcore/etc/pulp/server.yaml @@ -17,15 +17,15 @@ # shipped with your version of Django, or online at # https://docs.djangoproject.com/en/1.8/ref/settings/#databases # -# By default, Pulp will attempt to connect to PostgreSQL on a local Unix -# socket using the 'pulp' user with a database name of 'pulp'. +# By default, Pulp will use a sqlite3 database. If your environment is used in production +# consider configuring Postgresql or another Django supported database. # # databases: # default: # CONN_MAX_AGE: 0 -# ENGINE: django.db.backends.postgresql_psycopg2 -# NAME: pulp -# USER: pulp +# ENGINE: django.db.backends.sqlite3 +# NAME: +# USER: # PASSWORD: # HOST: # PORT: From f57863201d487456a6cc6c273b0545feaa25c3ee Mon Sep 17 00:00:00 2001 From: Brian Bouterse Date: Wed, 28 Feb 2018 18:00:41 -0500 Subject: [PATCH 2/2] Enables Travis testing This PR enables testing on both postgresql and sqlite. Thanks to @daviddavis for the .travis file changes! re #3359 --- .travis.yml | 9 +++++++-- pulpcore/pulpcore/app/settings.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 222bda6da4..2ba9b4885b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ sudo: false # https://docs.travis-ci.com/user/trusty-ci-environment/ dist: trusty language: python +env: + - DB=sqlite + - DB=postgres python: # python versions used in el7 SCL & supported fedora - "3.5" @@ -20,8 +23,10 @@ install: - "pushd pulpcore/ && pip install -e . && popd" - "pushd plugin/ && pip install -e . && popd" before_script: - - psql -U postgres -c "CREATE USER pulp WITH SUPERUSER LOGIN;" - - psql -U postgres -c "CREATE DATABASE pulp OWNER pulp;" + - sh -c "if [ '$DB' = 'postgres' ]; then sed -i \"s/'ENGINE': 'django.db.backends.sqlite3'/'ENGINE': 'django.db.backends.postgresql_psycopg2'/\" pulpcore/pulpcore/app/settings.py" + - sh -c "if [ '$DB' = 'postgres' ]; then sed -i \"s/'USER': ''/'USER': 'pulp'/\" pulpcore/pulpcore/app/settings.py" + - sh -c "if [ '$DB' = 'postgres' ]; then psql -U postgres -c 'CREATE USER pulp WITH SUPERUSER LOGIN;'" + - sh -c "if [ '$DB' = 'postgres' ]; then psql -U postgres -c 'CREATE DATABASE pulp OWNER pulp;'" script: # flake8 - "flake8 --config flake8.cfg" diff --git a/pulpcore/pulpcore/app/settings.py b/pulpcore/pulpcore/app/settings.py index 016a564cb7..08ba94585a 100644 --- a/pulpcore/pulpcore/app/settings.py +++ b/pulpcore/pulpcore/app/settings.py @@ -169,7 +169,7 @@ 'databases': { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': '', + 'NAME': 'pulp', 'USER': '', 'CONN_MAX_AGE': 0, },