From owner-freebsd-pkg@freebsd.org Thu Jun 8 00:53:33 2017 Return-Path: Delivered-To: freebsd-pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE03FB95416 for ; Thu, 8 Jun 2017 00:53:33 +0000 (UTC) (envelope-from isoa@kapsi.fi) Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:1bc8:1004::1:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97EF96684C for ; Thu, 8 Jun 2017 00:53:33 +0000 (UTC) (envelope-from isoa@kapsi.fi) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject; bh=g4OAzPakvgjSDpFl33MJzOzrrtUf+mgw8BQyLUsKdlk=; b=J9fulX/tirvY9HXRFLN25fw3JeEJnIE1g51SD+IOVGymgGd+KzVlsOjymTdytcI8doyw6b6F/UHMI4JL9uh8kzbbps1ZqYI2vlQ1wbNfEkxYlzt03dIcosYH3kfqrTm3CgR2g6JP3S2iaPZfi0k/Kg/fO9ET6ZEW0Aea0nt+KprhSunlAyb8FUDlkf/tuBeW7qW+yElyOSIFq+nanuXnzLAjjSGa7jcnpBA/hM4+Zs21SbvhqEV6gY2RmjViWRWBMDyTTw0GzkSb1a1ABjg/E/x7u+0yYstaAs48HM2GE2TbjJeVlEF5JbvcNFGfvSQy1qo4QX3HWZJnSXKgaKw9uA==; Received: from dsl-jklbng11-54fa58-115.dhcp.inet.fi ([84.250.88.115] helo=[192.168.255.112]) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1dIlhZ-0002q2-NG for freebsd-pkg@freebsd.org; Thu, 08 Jun 2017 03:53:29 +0300 Subject: Re: pkg rollback To: freebsd-pkg@freebsd.org References: From: Arto Pekkanen Message-ID: Date: Thu, 8 Jun 2017 03:53:18 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DOu5U8Set5d3w8wiurfCTmmJ9i7J0vjtH" X-SA-Exim-Connect-IP: 84.250.88.115 X-SA-Exim-Mail-From: isoa@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2017 00:53:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DOu5U8Set5d3w8wiurfCTmmJ9i7J0vjtH Content-Type: multipart/mixed; boundary="gFgSloURdD92owwCbcDwrjK9q8uBsEeXW"; protected-headers="v1" From: Arto Pekkanen To: freebsd-pkg@freebsd.org Message-ID: Subject: Re: pkg rollback References: In-Reply-To: --gFgSloURdD92owwCbcDwrjK9q8uBsEeXW Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Why does not ZFS snapshot and rollback work for this scenario? On 7.6.2017 16:40, Luca Pizzamiglio wrote: > Hi all, >=20 > I'm trying to figure out how an automatic process to upgrade packages > on production machines can look like. >=20 > A kind of: > # pkg upgrade > # restart services > # if everything not OK > # rollback > # restart services >=20 > I'm considering a package repository that is not guaranteeing 100% > stability, like `latest`. > Even intercepting events needing manual intervention (i.e. reported by > UPDATING), a blind pkg upgrade can break the web application running > on top. > So, I was thinking if it's possible to perform some kind of rollback. >=20 > to proof if it's possible, I wrote a shell scripts with two features > (it helped me a lot to understand how pkg works): > # backup > ## backup the repo sqlite database > ## run `pkg update` and determine all actions would be performed by > `pkg upgrade` (a kind of `pkg upgrade` simulation) > ## backup all packages from the cache that would be replaced by `pkg up= grade` > ## download all new packages to determine potentially conflicts > ## backup all packages from the cache that would be replaced by `pkg > upgrade` (after determined conflicts) > ## restore the repo sqlite database > # rollback > ## restore the repo sqlite database > ## install all previously backup'ed packages >=20 > Another approach, less complex, but I guess even valid, could be: > # backup (or snapshot) > ## backup of the repo sqlite database > ## take a snapshot of all installed packages > # rollback (a previously stored snapshot) > ## restore the repo sqlite database > ## reinstall all previously backup'ed packages >=20 > Adding two features [snapshot and rollback] to pkg(8), the automated > upgrade process would become: > # pkg snapshot > # pkg upgrade > # restart services > # if everything not OK > # rollback > # restart services >=20 > What do you think? > What am I missing? > Ideas, suggestions and feedback are welcome, so, please, feel free to r= eply. >=20 > Best regards, > Luca >=20 > PS: I'd use `pkg snapshot`, because `pkg backup` already exist and it > has another meaning. > PS2: In some case, `zfs snapshot` could work as well, but it's not > always possible > PS3: if feebacks are positive, I'd like to implement those features > _______________________________________________ > freebsd-pkg@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-pkg > To unsubscribe, send any mail to "freebsd-pkg-unsubscribe@freebsd.org" >=20 --=20 Arto Pekkanen --gFgSloURdD92owwCbcDwrjK9q8uBsEeXW-- --DOu5U8Set5d3w8wiurfCTmmJ9i7J0vjtH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREIAAYFAlk4oAkACgkQTBivhqtJa26pUQD/WU63lDyYeSXLu/y0kgJ7duqO n9jqCsc7vYuLnWNdgAAA/0xQwqRXUUxbCE0f82Cqr1TsUIAZWs88GsxZlQ0Ez1vm =Fqx+ -----END PGP SIGNATURE----- --DOu5U8Set5d3w8wiurfCTmmJ9i7J0vjtH--