Merge pull request #1918 from MorrisJobke/arch-linux

Adds support for ArchLinux as host OS
This commit is contained in:
Jose Diaz-Gonzalez committed 2016-02-25 01:26:06 -05:00
commit fd059da29b
11 files changed
+116 -8

No files matched your search

+1 -1
View File
@@ -27,6 +27,7 @@ endif
include tests.mk include tests.mk
include deb.mk include deb.mk
include arch.mk
all: all:
# Type "make install" to install. # Type "make install" to install.
@@ -155,4 +156,3 @@ vagrant-acl-add:
vagrant-dokku: vagrant-dokku:
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'" vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"
Vendored
+10
View File
@@ -76,6 +76,16 @@ Vagrant::configure("2") do |config|
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all" vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
end end
config.vm.define "build-arch", autostart: false do |vm|
vm.vm.box = "bugyt/archlinux"
vm.vm.synced_folder File.dirname(__FILE__), "/dokku"
vm.vm.synced_folder "#{File.dirname(__FILE__)}/../dokku-arch", "/dokku-arch"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /dokku && make arch-all", privileged: false
end
if Pathname.new(PUBLIC_KEY_PATH).exist? if Pathname.new(PUBLIC_KEY_PATH).exist?
config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub' config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub'
config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys" config.vm.provision :shell, :inline => "rm -f /root/.ssh/authorized_keys && mkdir -p /root/.ssh && sudo cp /tmp/id_rsa.pub /root/.ssh/authorized_keys"
+28
View File
@@ -0,0 +1,28 @@
.PHONY: arch-all arch-dokku
arch-all: arch-dokku
echo "Done"
arch-setup:
echo "-> Updating pacman repository and installing package helper"
sudo pacman -Sy
sudo pacman -S --needed --noconfirm pkgbuild-introspection
echo "-> Download, build and install cower (dependency of pacaur) and pacaur"
curl -so /tmp/cower.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/cower.tar.gz
curl -so /tmp/pacaur.tar.gz https://aur.archlinux.org/cgit/aur.git/snapshot/pacaur.tar.gz
tar -xzf /tmp/cower.tar.gz -C /tmp
tar -xzf /tmp/pacaur.tar.gz -C /tmp
gpg --recv-key 1EB2638FF56C0C53
cd /tmp/cower; makepkg -sri --noconfirm
cd /tmp/pacaur; makepkg -sri --noconfirm
echo "-> Installing build requirements"
pacaur --noconfirm --noedit -S plugn
arch-dokku: arch-setup
echo "-> Update package sums, create metadata file and test the build of the package"
git describe --tags > /tmp/VERSION
cat /tmp/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/STABLE_VERSION
sed -i -e "s/pkgver=.*/pkgver=`cat /tmp/STABLE_VERSION`/" /dokku-arch/PKGBUILD
cd /dokku-arch; updpkgsums; mksrcinfo; makepkg -fd
+44
View File
@@ -23,6 +23,7 @@ To propose a release, the following tasks need to be performed:
- Debian packages *must* be created via `vagrant up build` - Debian packages *must* be created via `vagrant up build`
- The packages should be uploaded to packagecloud.io - The packages should be uploaded to packagecloud.io
- All changes are pushed to master and the tag should be turned into a release which will contain the changelog. - All changes are pushed to master and the tag should be turned into a release which will contain the changelog.
- ArchLinux package description *must* be updated via `vagrant up build-arch` (needs to be done after the tag is pushed to GitHub, because it is based on that)
## Versioning ## Versioning
@@ -56,6 +57,24 @@ If new versions of other packages were created, these should also be pushed at t
> If you are a maintainer and need the PACKAGECLOUD_TOKEN in order to make a release, please contact @josegonzalez to get this information. > If you are a maintainer and need the PACKAGECLOUD_TOKEN in order to make a release, please contact @josegonzalez to get this information.
## ArchLinux Pacakages
ArchLinux packages are not really build, because all that is needed for an Arch User Repo (AUR) package is the description of how to build the package. To make this process as easy as possible there is a vagrant box called `build-arch` that updates the version of this build description (a file called `PKGBUILD`), then runs some helper scripts to fill all aditional information and does test if the package could be build. Then only those changes need to be pushed to the AUR repo and an updated version of the package is ready for usage for our ArchLinux users. For detailed information see the section below.
The workflow looks like this:
```shell
# having dokku-arch in ../dokku-arch
vagrant up build-arch
# wait for "==> build-arch: ==> Finished making: dokku 0.4.14-2 (Mon Feb 22 23:20:37 CET 2016)"
cd ../dokku-arch
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'
git push aur master
```
> If you are a maintainer and need access to the AUR repositories in order to make a release, please contact @morrisjobke or @josegonzalez to get this co-maintainership.
## Changelog format ## Changelog format
The `HISTORY.md` should be added to based on the changes made since the previous release. This can be done by reviewing all merged pull requests to the master branch on github. The format is as follows: The `HISTORY.md` should be added to based on the changes made since the previous release. This can be done by reviewing all merged pull requests to the master branch on github. The format is as follows:
@@ -77,3 +96,28 @@ Some description concerning major changes in this release, or potential incompat
- #SOME_ID: @pull-request-creator Description - #SOME_ID: @pull-request-creator Description
``` ```
## Detailed information for ArchLinux packages
All of the information to build the ArchLinux package is in the AUR git repository (see [dokku AUR page](https://aur.archlinux.org/packages/dokku/)). The release of a AUR package only consists of pushing the package information into the AUR git repo. Then users could use that information to build the package on their machines.
To update the package clone the repository and adjust the files in the repository. Then a helper script - `updpkgsums` - to update the SHA sum could be called (check against the original SHA sum). Another helper script - `mksrcinfo` - needs to be called to update the meta information of the package in a file called `.SRCINFO`. The next step builds the package locally for verification - `makepkg`. As last step commit your changes and push the commit.
* dependencies are defined in the `depends` attribute in `PKGBUILD`
* build steps during package build time are defined in the `package()` method in `PKGBUILD`
* steps that should be executed during install/update/remove time are defined in the file `dokku.install`
* detailed information about all attributes in `PKGBUILD` could be found in the [ArchLinux wiki](https://wiki.archlinux.org/index.php/PKGBUILD)
* detailed information about the AUR workflow could be found in the [AUR article](https://wiki.archlinux.org/index.php/Arch_User_Repository) in the ArchLinux wiki
That is the usual workflow:
```shell
updpkgsums # update sha sums - compare them with the original ones
mksrcinfo # update package metadata for AUR
makepkg # test package builds
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'
git push
```
> If there is something unclear simply ask @morrisjobke for help.
+3
View File
@@ -3,6 +3,9 @@ set -eo pipefail
shopt -s nullglob shopt -s nullglob
case "$(lsb_release -si)" in case "$(lsb_release -si)" in
Arch)
export DOKKU_DISTRO=${DOKKU_DISTRO:="arch"}
;;
Debian) Debian)
export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"} export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"}
;; ;;
+4 -2
View File
@@ -9,6 +9,8 @@ if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST" [[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi fi
dokku_path=$(which dokku)
# temporary hack for https://github.com/dokku/dokku/issues/82 # temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot # redeploys all apps after a reboot
if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then
@@ -19,7 +21,7 @@ start on filesystem and started docker
script script
sleep 2 # give docker some time sleep 2 # give docker some time
sudo -i -u dokku /usr/local/bin/dokku ps:restore sudo -i -u dokku $dokku_path ps:restore
end script end script
EOF EOF
fi fi
@@ -33,7 +35,7 @@ After=docker.target
[Service] [Service]
Type=simple Type=simple
User=dokku User=dokku
ExecStart=/usr/local/bin/dokku ps:restore ExecStart=$dokku_path ps:restore
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
+6 -5
View File
@@ -2,7 +2,8 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
DOKKU_RSYSLOG_FILTER=/etc/rsyslog.d/99-dokku.conf DOKKU_RSYSLOG_FILTER_DIR=/etc/rsyslog.d
DOKKU_RSYSLOG_FILTER=$DOKKU_RSYSLOG_FILTER_DIR/99-dokku.conf
DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku DOKKU_LOGROTATE_FILE=/etc/logrotate.d/dokku
flag_rsyslog_needs_restart=n flag_rsyslog_needs_restart=n
@@ -11,7 +12,7 @@ flag_rsyslog_needs_restart=n
# exits gracefully if the path already exists # exits gracefully if the path already exists
mkdir -m 775 -p "$DOKKU_LOGS_DIR" mkdir -m 775 -p "$DOKKU_LOGS_DIR"
case "$DOKKU_DISTRO" in case "$DOKKU_DISTRO" in
debian) arch|debian)
chgrp dokku "$DOKKU_LOGS_DIR" chgrp dokku "$DOKKU_LOGS_DIR"
;; ;;
*) *)
@@ -22,7 +23,7 @@ esac
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
touch "$DOKKU_EVENTS_LOGFILE" touch "$DOKKU_EVENTS_LOGFILE"
case "$DOKKU_DISTRO" in case "$DOKKU_DISTRO" in
debian) arch|debian)
chgrp dokku "$DOKKU_EVENTS_LOGFILE" chgrp dokku "$DOKKU_EVENTS_LOGFILE"
;; ;;
*) *)
@@ -33,7 +34,7 @@ if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
chmod 664 "$DOKKU_EVENTS_LOGFILE" chmod 664 "$DOKKU_EVENTS_LOGFILE"
fi fi
if [[ ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
:syslogtag, contains, "dokku" $DOKKU_EVENTS_LOGFILE :syslogtag, contains, "dokku" $DOKKU_EVENTS_LOGFILE
EOF EOF
@@ -64,7 +65,7 @@ EOF
flag_rsyslog_needs_restart=y flag_rsyslog_needs_restart=y
fi fi
if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then if [[ -f "$DOKKU_RSYSLOG_FILTER" && "$flag_rsyslog_needs_restart" == "y" ]]; then
service rsyslog restart service rsyslog restart
fi fi
+4
View File
@@ -25,4 +25,8 @@ case "$DOKKU_DISTRO" in
opensuse) opensuse)
zypper -q in -y nginx bind-utils zypper -q in -y nginx bind-utils
;; ;;
arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;
esac esac
+4
View File
@@ -32,6 +32,10 @@ restart_nginx() {
opensuse) opensuse)
sudo /sbin/service nginx reload > /dev/null sudo /sbin/service nginx reload > /dev/null
;; ;;
arch)
sudo /usr/bin/systemctl reload nginx
;;
esac esac
} }
+8
View File
@@ -13,6 +13,10 @@ case "$DOKKU_DISTRO" in
opensuse) opensuse)
echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx echo "%dokku ALL=(ALL) NOPASSWD:/sbin/service nginx reload, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
;; ;;
arch)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload nginx, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
;;
esac esac
chmod 0440 /etc/sudoers.d/dokku-nginx chmod 0440 /etc/sudoers.d/dokku-nginx
@@ -57,4 +61,8 @@ case "$DOKKU_DISTRO" in
opensuse) opensuse)
/sbin/service nginx start /sbin/service nginx start
;; ;;
arch)
/usr/bin/systemctl start nginx
;;
esac esac
+4
View File
@@ -14,4 +14,8 @@ case "$DOKKU_DISTRO" in
opensuse) opensuse)
sudo /sbin/service nginx reload > /dev/null sudo /sbin/service nginx reload > /dev/null
;; ;;
arch)
sudo /usr/bin/systemctl reload nginx
;;
esac esac