这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif

include tests.mk
include deb.mk
include arch.mk

all:
# Type "make install" to install.
Expand Down Expand Up @@ -155,4 +156,3 @@ vagrant-acl-add:

vagrant-dokku:
vagrant ssh -- "sudo -H -u root bash -c 'dokku $(RUN_ARGS)'"

10 changes: 10 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ Vagrant::configure("2") do |config|
vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all"
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?
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"
Expand Down
28 changes: 28 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.PHONY: arch-all arch-dokku

arch-all: arch-dokku
echo "Done"

arch-setup:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What calls this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn ... I removed this to speed up the test runs :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

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 changes: 44 additions & 0 deletions docs/development/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ To propose a release, the following tasks need to be performed:
- Debian packages *must* be created via `vagrant up build`
- 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.
- 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

Expand Down Expand Up @@ -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.

## 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

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:
Expand All @@ -77,3 +96,28 @@ Some description concerning major changes in this release, or potential incompat

- #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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these commands only available on arch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - and the derivates, because they come with the package manager.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the Vagrantfile so I can have a vm for running these arch commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ pacman -Qo /usr/bin/updpkgsums
/usr/bin/updpkgsums ist in pacman 5.0.0-1 enthalten
$ pacman -Qo /usr/bin/makepkg   
/usr/bin/makepkg ist in pacman 5.0.0-1 enthalten
$ pacman -Qo /usr/bin/mksrcinfo
/usr/bin/mksrcinfo ist in pkgbuild-introspection 8-1 enthalten

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the Vagrantfile so I can have a vm for running these arch commands?

Where should the Vagrant file go? Because the build information is in a different repo (see below - the AUR repo).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you hop on slack so we can discuss this?

mksrcinfo # update package metadata for AUR
makepkg # test package builds
git add PKGBUILD .SRCINFO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files should also be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should know, that you then need to copy them between git repos then - I would keep them in the AUR repo only. Those commands should be executed in the AUR git repo clone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but I'm basically going to git push to both the github repo and the arch repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that are different repos 😕

This is what the AUR repo contains: https://aur.archlinux.org/cgit/aur.git/tree/?h=dokku

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha. Okay, I will create a dokku-arch repo so we can track that arch repo on our end as well. Sound good?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure :)

git commit -m 'Update to dokku 0.9.9'
git push
```

> If there is something unclear simply ask @morrisjobke for help.
3 changes: 3 additions & 0 deletions dokku
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -eo pipefail
shopt -s nullglob

case "$(lsb_release -si)" in
Arch)
export DOKKU_DISTRO=${DOKKU_DISTRO:="arch"}
;;
Debian)
export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"}
;;
Expand Down
6 changes: 4 additions & 2 deletions plugins/00_dokku-standard/install
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short "$(< "$DOKKU_ROOT/HOSTNAME")") ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi

dokku_path=$(which dokku)

# temporary hack for https://github.com/dokku/dokku/issues/82
# redeploys all apps after a reboot
if [[ $(/sbin/init --version 2> /dev/null) =~ upstart ]]; then
Expand All @@ -19,7 +21,7 @@ start on filesystem and started docker

script
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
EOF
fi
Expand All @@ -33,7 +35,7 @@ After=docker.target
[Service]
Type=simple
User=dokku
ExecStart=/usr/local/bin/dokku ps:restore
ExecStart=$dokku_path ps:restore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelshobbs @josegonzalez I added the changes to this file to fix the restore process on ArchLinux. It works there just fine and should also work without issues on all other platforms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the file located on arch linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binaries on arch usually reside in /usr/bin/ - they had some huge restructurings some time ago, when they moved a lot to one location.


[Install]
WantedBy=multi-user.target
Expand Down
11 changes: 6 additions & 5 deletions plugins/20_events/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
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

flag_rsyslog_needs_restart=n
Expand All @@ -11,7 +12,7 @@ flag_rsyslog_needs_restart=n
# exits gracefully if the path already exists
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
case "$DOKKU_DISTRO" in
debian)
arch|debian)
chgrp dokku "$DOKKU_LOGS_DIR"
;;
*)
Expand All @@ -22,7 +23,7 @@ esac
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
touch "$DOKKU_EVENTS_LOGFILE"
case "$DOKKU_DISTRO" in
debian)
arch|debian)
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
;;
*)
Expand All @@ -33,7 +34,7 @@ if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
chmod 664 "$DOKKU_EVENTS_LOGFILE"
fi

if [[ ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
if [[ -d "$DOKKU_RSYSLOG_FILTER_DIR" && ! -f "$DOKKU_RSYSLOG_FILTER" ]]; then
cat >"$DOKKU_RSYSLOG_FILTER" <<EOF
:syslogtag, contains, "dokku" $DOKKU_EVENTS_LOGFILE
EOF
Expand Down Expand Up @@ -64,7 +65,7 @@ EOF
flag_rsyslog_needs_restart=y
fi

if [[ "$flag_rsyslog_needs_restart" == "y" ]]; then
if [[ -f "$DOKKU_RSYSLOG_FILTER" && "$flag_rsyslog_needs_restart" == "y" ]]; then
service rsyslog restart
fi

Expand Down
4 changes: 4 additions & 0 deletions plugins/nginx-vhosts/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ case "$DOKKU_DISTRO" in
opensuse)
zypper -q in -y nginx bind-utils
;;

arch)
pacman -S --noconfirm --noprogressbar --needed nginx bind-tools
;;
esac
4 changes: 4 additions & 0 deletions plugins/nginx-vhosts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ restart_nginx() {
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;

arch)
sudo /usr/bin/systemctl reload nginx
;;
esac
}

Expand Down
8 changes: 8 additions & 0 deletions plugins/nginx-vhosts/install
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ case "$DOKKU_DISTRO" in
opensuse)
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

chmod 0440 /etc/sudoers.d/dokku-nginx
Expand Down Expand Up @@ -57,4 +61,8 @@ case "$DOKKU_DISTRO" in
opensuse)
/sbin/service nginx start
;;

arch)
/usr/bin/systemctl start nginx
;;
esac
4 changes: 4 additions & 0 deletions plugins/nginx-vhosts/post-delete
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ case "$DOKKU_DISTRO" in
opensuse)
sudo /sbin/service nginx reload > /dev/null
;;

arch)
sudo /usr/bin/systemctl reload nginx
;;
esac