From patchwork Fri May 3 07:33:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 1094716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44wPsh6Mw3z9s9G for ; Fri, 3 May 2019 18:08:56 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.b="R2RTxFkJ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="S5C2rjsV"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44wPsh5WsTzDqgj for ; Fri, 3 May 2019 18:08:56 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=russell.cc (client-ip=66.111.4.29; helo=out5-smtp.messagingengine.com; envelope-from=ruscur@russell.cc; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=russell.cc Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=russell.cc header.i=@russell.cc header.b="R2RTxFkJ"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="S5C2rjsV"; dkim-atps=neutral X-Greylist: delayed 560 seconds by postgrey-1.36 at bilbo; Fri, 03 May 2019 17:43:07 AEST Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44wPHv41r5zDqrs for ; Fri, 3 May 2019 17:43:07 +1000 (AEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 398AC21B10; Fri, 3 May 2019 03:33:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 03 May 2019 03:33:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=qCtRGMNLnhbs2BK5XgCtpoSANj ZmRN+0tny9RALsEGQ=; b=R2RTxFkJsfZxifbgMorzE8pHpwrufvrrNK36zOFi8z HT4rziWfxWr5Nq5UvEDhv22vguRUgKg2G6mI/7qAkWheDtiXzZlC6xCLGlfPxG1t B2pX1O5kUSgjRFHrgayiyuhCheoBbkn8U0bqHUOwd4osaMepbtbeHlSiFd77iiC4 /Ay6B3B0uxj70sLUPXT+2sA02ZWtCPBIgT8YmgNiPpNmb/GB43J3IcrTxnCZuAKE m9QKKR9ivglWwg/Ea9WhxaUgI3BRrMq3ljvaYzHjsfm7qsDaMI6i7WjZq/T7nhtE GAQq+7NmcVcEXBkJmfWCK3e540S3IEb+MN5SnU50PYMg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=qCtRGMNLnhbs2BK5X gCtpoSANjZmRN+0tny9RALsEGQ=; b=S5C2rjsVHimbBbxORUdkSSzdwimhSG/Gc qLP62uifmXegcT/+pZxqHES8fdw1cGRptPQWdOHzOQ0YMK9cQNkLJgeetsdOtySe Rj4uPs+aXI1p7QXO6C0M/R5sMNsTk1x7TRuNcFqyLdP6+Jpu2sFHvtsaYh3kQjLL 1uVrZLzldlSfATAxZdovlegGQv+oJ4xjOlftKSuyqOoGFt0oUicLO1O2SkI/3+aj PCdUmUMFvXS5Yj/X3FsIUw0uVfgtBvAqMUv4W9a0RhHvDg4LuXGQpBldQKC+0mAq PNyaxYQxi5f7IMHzhNzGaRl3wwagqvK6UcY76+Lm/kTYDBl36SpDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjedtgdduvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfedtmdenucfjughrpefhvf fufffkofgggfestdekredtredttdenucfhrhhomheptfhushhsvghllhcuvehurhhrvgih uceorhhushgtuhhrsehruhhsshgvlhhlrdgttgeqnecukfhppeduvddvrdelledrkedvrd dutdenucfrrghrrghmpehmrghilhhfrhhomheprhhushgtuhhrsehruhhsshgvlhhlrdgt tgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from crackle.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id AFFC8E44A1; Fri, 3 May 2019 03:33:40 -0400 (EDT) From: Russell Currey To: patchwork@lists.ozlabs.org Subject: [RFC PATCH] docker: Add support for using eatmydata in the database Date: Fri, 3 May 2019 17:33:17 +1000 Message-Id: <20190503073317.30098-1-ruscur@russell.cc> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" When running tox on a VM with presumably pretty busy spinning disks, using eatmydata with the database took running one configuration's test suite from (no exaggeration) 20 minutes down to 60 seconds. It makes a huge difference to test speed, so we should make it easily available for developers. The primary motivation here was to automatically test each patch in a timeframe that isn't insane. Open to ideas on how to organise this, whether we do it for MySQL too (which we probably should), whether the base directory should have these files in it, what to call the Dockerfile, etc. I think it's a good thing to have in the repo, though. Signed-off-by: Russell Currey Reviewed-by: Andrew Donnellan --- docker-compose-eatmydata.yml | 32 +++++++++++++++++++++++++++++++ tools/docker/Dockerfile.eatmydata | 9 +++++++++ 2 files changed, 41 insertions(+) create mode 100644 docker-compose-eatmydata.yml create mode 100644 tools/docker/Dockerfile.eatmydata diff --git a/docker-compose-eatmydata.yml b/docker-compose-eatmydata.yml new file mode 100644 index 0000000..27d1604 --- /dev/null +++ b/docker-compose-eatmydata.yml @@ -0,0 +1,32 @@ +version: "3" +services: + db: + build: + context: . + dockerfile: ./tools/docker/Dockerfile.eatmydata + volumes: + - ./tools/docker/db/postdata:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=password + + web: + build: + context: . + dockerfile: ./tools/docker/Dockerfile + args: + - UID + depends_on: + - db + command: python3 manage.py runserver 0.0.0.0:8000 + volumes: + - .:/home/patchwork/patchwork/ + ports: + - "8000:8000" + environment: + - UID + - PW_TEST_DB_HOST=db + - PW_TEST_DB_PORT=5432 + - PW_TEST_DB_TYPE=postgres + - PW_TEST_DB_USER=postgres + - PW_TEST_DB_PASS=password + - PGPASSWORD=password diff --git a/tools/docker/Dockerfile.eatmydata b/tools/docker/Dockerfile.eatmydata new file mode 100644 index 0000000..693cbb3 --- /dev/null +++ b/tools/docker/Dockerfile.eatmydata @@ -0,0 +1,9 @@ +FROM postgres:9.6 + +RUN apt-get update \ + && apt-get install -y eatmydata \ + && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT [ "/usr/bin/eatmydata", "/usr/local/bin/docker-entrypoint.sh" ] +CMD ["postgres"]