Skip to content

Commit

Permalink
Split up "scripts" directory and move docs
Browse files Browse the repository at this point in the history
Cleanup time!

Split up the "scripts" directory:

- Move the scripts/examples directory to the top level.
- Move scripts to be included with releases into a new "overlay"
  directory.
- Move build tools into a new "tools" directory.
- Also, move most documentation into the "doc" directory.
  • Loading branch information
weiss committed Jul 31, 2023
1 parent b21fef4 commit d52cfce
Show file tree
Hide file tree
Showing 41 changed files with 74 additions and 73 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/container-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'doc/**'
- 'docker-k8s/examples/**'
- 'Formula/**'
- 'scripts/get-version'
- 'tools/get-version'
- 'windows/**'
- '**.md'
schedule:
Expand All @@ -18,7 +18,7 @@ on:
- 'doc/**'
- 'docker-k8s/examples/**'
- 'Formula/**'
- 'scripts/get-version'
- 'tools/get-version'
- 'windows/**'
- '**.md'

Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
-
name: On push master | extract git version
if: needs.detect-change.outputs.update == 'false'
run: echo "TAG_VERSION=$(echo "$(./scripts/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
run: echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tag
if: needs.detect-change.outputs.update == 'true'
Expand All @@ -100,7 +100,7 @@ jobs:
python3-dev autoconf automake libtool libtool-bin gawk wget bzip2 \
xz-utils unzip patch libstdc++6 rsync git meson ninja-build \
binfmt-support qemu-user-static
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' scripts/make-binaries)" >> $GITHUB_ENV
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.arch }} | sed -e 's|x64|x86_64|;s|arm64|aarch64|')" >> $GITHUB_ENV
-
name: Install erlang/OTP
Expand All @@ -110,7 +110,7 @@ jobs:
version-type: strict
-
name: Build ${{ matrix.arch }} musl-libc based binary archives
run: CHECK_DEPS=false scripts/make-binaries ${{ env.ARCH }}-linux-musl
run: CHECK_DEPS=false tools/make-binaries ${{ env.ARCH }}-linux-musl
-
name: Start container for rebar3 test suites ...
run: |
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
-
name: On push master | extract git version
if: needs.detect-change.outputs.update == 'false'
run: echo "TAG_VERSION=$(echo "$(./scripts/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
run: echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tag
if: needs.detect-change.outputs.update == 'true'
Expand Down Expand Up @@ -249,7 +249,7 @@ jobs:
-
name: On push master | extract git version
if: needs.detect-change.outputs.update == 'false'
run: echo "TAG_VERSION=$(echo "$(./scripts/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
run: echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tag
if: needs.detect-change.outputs.update == 'true'
Expand Down Expand Up @@ -337,9 +337,9 @@ jobs:
if: needs.detect-change.outputs.update == 'false'
run: |
echo "VSN=$(git describe --tag)" >> $GITHUB_ENV
echo "TAG_VERSION=$(echo "$(./scripts/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
echo "SRC=local" >> $GITHUB_ENV
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' scripts/make-binaries)" >> $GITHUB_ENV
echo "OTP_VSN=$(awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}' tools/make-binaries)" >> $GITHUB_ENV
-
name: On release | extract git version and define build mode
if: needs.detect-change.outputs.update == 'true'
Expand All @@ -349,7 +349,7 @@ jobs:
echo "TAG_VERSION=$(awk 'END{gsub("-", " "); print $1}' ${{ env.PKGREL_FILE }})" >> $GITHUB_ENV
# define erlang/OTP version
echo "OTP_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/scripts/make-binaries \
echo "OTP_VSN=$(wget -O - https://raw.githubusercontent.com/${{ github.repository }}/$eturnal_vsn/tools/make-binaries \
| awk '/^otp_vsn=/ {{gsub(/[^0-9.]/, ""); print}}')" >> $GITHUB_ENV
# check whether to build from archive or git, because git repo is HEAD here
Expand Down Expand Up @@ -444,7 +444,7 @@ jobs:
name: On push master | extract git version and define build variants
if: needs.detect-change.outputs.update == 'false'
run: |
echo "TAG_VERSION=$(echo "$(./scripts/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
echo "TAG_VERSION=$(echo "$(./tools/get-version)" | sed -e 's|+|-|')" >> $GITHUB_ENV
-
name: On release | extract release tags to be published/updated
if: needs.detect-change.outputs.update == 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v3
with: # For scripts/get-version:
with: # For tools/get-version:
fetch-depth: 0
- name: Install dependencies
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v3
with: # For scripts/get-version:
with: # For tools/get-version:
fetch-depth: 0
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
run: windows/make-installer
shell: bash
- name: Install and start eturnal
run: ./eturnal-$(scripts/get-version)-x64 //SP- //VERYSILENT //SUPPRESSMSGBOXES
run: ./eturnal-$(tools/get-version)-x64 //SP- //VERYSILENT //SUPPRESSMSGBOXES
shell: bash
timeout-minutes: 10
- name: Restart eturnal
Expand Down
2 changes: 1 addition & 1 deletion Formula/eturnal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def install
s.gsub! "$ETURNAL_ETC_PREFIX/etc/#{name}.yml", "#{etc}/#{name}.yml"
end
## fix eturnalctl
inreplace "scripts/eturnalctl" do |s|
inreplace "overlay/eturnalctl" do |s|
s.gsub! "(readlink ", "(readlink -f "
end
end
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ As an alternative, there's an `#eturnal` channel [on Slack][23].
[1]: https://github.com/processone/eturnal/actions/workflows/ci.yml
[2]: https://eturnal.net/
[3]: https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00
[4]: https://github.com/processone/eturnal/blob/master/QUICK-TEST.md
[4]: https://github.com/processone/eturnal/blob/master/doc/QUICK-TEST.md
[5]: https://github.com/processone/eturnal/blob/master/docker-k8s/QUICK-TEST.md
[6]: https://eturnal.net/documentation/code/docker.html
[7]: https://software.opensuse.org/download/?package=eturnal&project=devel:languages:erlang
[8]: https://pkgs.alpinelinux.org/packages?name=eturnal
[9]: https://eturnal.net/documentation/#Installation
[10]: https://eturnal.net/windows/
[11]: https://github.com/processone/eturnal/blob/1.10.1/INSTALL.md
[11]: https://github.com/processone/eturnal/blob/1.10.1/doc/INSTALL.md
[12]: https://en.wikipedia.org/wiki/YAML
[13]: https://github.com/processone/eturnal/blob/1.10.1/config/eturnal.yml
[14]: https://www.freedesktop.org/software/systemd/man/systemctl.html
[15]: https://github.com/processone/eturnal/blob/1.10.1/scripts/eturnal.init
[16]: https://github.com/processone/eturnal/blob/1.10.1/scripts/eturnal.openrc
[15]: https://github.com/processone/eturnal/blob/1.10.1/overlay/init/sysv/eturnal
[16]: https://github.com/processone/eturnal/blob/1.10.1/overlay/init/openrc/eturnal.initd
[17]: https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html
[18]: https://eturnal.net/documentation/
[19]: https://github.com/processone/eturnal/blob/1.10.1/CHANGELOG.md
Expand Down
2 changes: 1 addition & 1 deletion config/reltool.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%%%
%%% $ rebar3 compile
%%% $ mkdir rel include priv
%%% $ sed -i "s/1\\.0\\.0/$(scripts/get-version)/" config/reltool.config
%%% $ sed -i "s/1\\.0\\.0/$(tools/get-version)/" config/reltool.config
%%% $ erl -noinput -eval '
%%% {ok, Conf} = file:consult("config/reltool.config"),
%%% {ok, Spec} = reltool:get_target_spec(Conf),
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions PACKAGING.md → doc/PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ directory structure.
Dependency Management
---------------------

Besides the dependencies [mentioned][3] in the [INSTALL.md][4] file, eturnal
Besides the dependencies [mentioned][3] in the [doc/INSTALL.md][4] file, eturnal
depends on the Erlang libraries referenced as `deps` in the [rebar.config][5]
file, _except_ for `recon` (which is just included for debugging purposes). The
complete list of (direct and transitive) Erlang dependencies is:
Expand Down Expand Up @@ -83,14 +83,14 @@ directory. Other directories created below the `_build` folder can be ignored.

[1]: https://erlang.org/doc/design_principles/release_structure.html
[2]: https://rebar3.org
[3]: https://github.com/processone/eturnal/blob/master/INSTALL.md#requirements
[4]: https://github.com/processone/eturnal/blob/master/INSTALL.md
[3]: https://github.com/processone/eturnal/blob/master/doc/INSTALL.md#requirements
[4]: https://github.com/processone/eturnal/blob/master/doc/INSTALL.md
[5]: https://github.com/processone/eturnal/blob/master/rebar.config
[6]: https://eturnal.net/download/
[7]: https://github.com/processone/eturnal/blob/master/build.config
[8]: https://github.com/processone/eturnal/blob/master/scripts/eturnalctl
[8]: https://github.com/processone/eturnal/blob/master/overlay/eturnalctl
[9]: https://github.com/processone/eturnal/blob/master/config/eturnal.yml
[10]: https://github.com/processone/eturnal/blob/master/config/eturnal.service
[11]: https://github.com/processone/eturnal/blob/master/scripts/eturnal.init
[12]: https://github.com/processone/eturnal/blob/master/scripts/eturnal.openrc
[10]: https://github.com/processone/eturnal/blob/master/overlay/init/systemd/eturnal.service
[11]: https://github.com/processone/eturnal/blob/master/overlay/init/sysv/eturnal
[12]: https://github.com/processone/eturnal/blob/master/overlay/init/openrc/eturnal.initd
[13]: https://github.com/processone/eturnal/blob/master/LICENSE
File renamed without changes.
4 changes: 2 additions & 2 deletions doc/overview.edoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ clients receive temporary TURN credentials where the user name is comprised of
the (Unix) expiry timestamp and the password is derived from a {@section secret}
shared between the service generating those credentials and eturnal. The service
offering the credentials <a
href="https://github.com/processone/eturnal/blob/1.10.1/scripts/examples/make-credentials">performs</a>
href="https://github.com/processone/eturnal/blob/1.10.1/examples/make-credentials">performs</a>
a `Base64(HMAC-SHA1($secret, $timestamp))' operation to generate the ephemeral
password, and eturnal does the same to verify it.

Expand All @@ -51,7 +51,7 @@ Linux/x64 and Linux/arm64 systems, the <a
href="https://eturnal.net/download/linux/installer/">binary release</a> can be
installed as described in this section. For building eturnal from source, see
the <a
href="https://github.com/processone/eturnal/blob/1.10.1/INSTALL.md">INSTALL.md</a>
href="https://github.com/processone/eturnal/blob/1.10.1/doc/INSTALL.md">INSTALL.md</a>
file shipped with eturnal's <a
href="https://eturnal.net/download/eturnal-1.10.1.tar.gz">source code
archive</a>.
Expand Down
2 changes: 1 addition & 1 deletion docker-k8s/image/Dockerfile.ctng
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN apt-get update \
WORKDIR /eturnal

ENTRYPOINT ["/usr/bin/tini","--"]
CMD ["/eturnal/scripts/make-binaries"]
CMD ["/eturnal/tools/make-binaries"]
6 changes: 3 additions & 3 deletions docker-k8s/image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ default build process defined by the build arguments in the `Dockerfile`.
C(web) -. SOURCE='web'<br/>VERSION='x.x.x' .-> D;
end
subgraph install from binary tarball
K[(output from:<br/>scripts/make-binaries)] -. eturnal-*musl*.tar.gz .-> E;
K[(output from:<br/>tools/make-binaries)] -. eturnal-*musl*.tar.gz .-> E;
end
D(build) == METHOD='build' ==> F;
E(package) -. METHOD='package' .-> F;
Expand Down Expand Up @@ -75,7 +75,7 @@ docker buildx build --load \
```

Building with `METHOD='package'` requires eturnal binary tarballs built with the
[make-binaries](../../scripts/make-binaries) script from this repository. The
[make-binaries](../../tools/make-binaries) script from this repository. The
respective targets must be `x86_64-linux-musl` or `aarch64-linux-musl`. This
depends of course on the image variant you want to build. The tarballs must be
located in the root of the repository.
Expand Down Expand Up @@ -108,7 +108,7 @@ hence, `$(uname -m)-linux-gnu` in the targets below.

```shell
targets="$(uname -m)-linux-gnu $(uname -m)-linux-musl"
sed -i "s|targets='.*'|targets='$targets'|" $PWD/scripts/make-binaries
sed -i "s|targets='.*'|targets='$targets'|" $PWD/tools/make-binaries
docker run --rm -d \
--name ctng-eturnal \
--user $(id -u $(whoami)) \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 19 additions & 19 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
recon]}.

{relx,
[{release, {eturnal, {cmd, "scripts/get-version"}},
[{release, {eturnal, {cmd, "tools/get-version"}},
[eturnal,
sasl,
recon,
Expand Down Expand Up @@ -51,22 +51,22 @@
{copy, "CHANGELOG.md", "doc/CHANGELOG.md"},
{copy, "README.md", "doc/README.md"},
{copy, "config/eturnal.yml", "etc/eturnal.yml"},
{copy, "config/eturnal.openrc", "etc/openrc/eturnal.confd"},
{copy, "config/eturnal.logrotate", "etc/logrotate.d/eturnal"},
{copy, "scripts/hooks/pre_start", "bin/hooks/pre_start"},
{copy, "scripts/hooks/post_stop", "bin/hooks/post_stop"},
{copy, "scripts/extensions/credentials", "bin/extensions/credentials"},
{copy, "scripts/extensions/disconnect", "bin/extensions/disconnect"},
{copy, "scripts/extensions/info", "bin/extensions/info"},
{copy, "scripts/extensions/loglevel", "bin/extensions/loglevel"},
{copy, "scripts/extensions/password", "bin/extensions/password"},
{copy, "scripts/extensions/reload", "bin/extensions/reload"},
{copy, "scripts/extensions/sessions", "bin/extensions/sessions"},
{template, "scripts/extensions/version", "bin/extensions/version"},
{template, "scripts/eturnalctl", "bin/eturnalctl"},
{template, "scripts/eturnal.init", "etc/init.d/eturnal"},
{template, "scripts/eturnal.openrc", "etc/openrc/eturnal.initd"},
{template, "config/eturnal.service", "etc/systemd/system/eturnal.service"}]}]}.
{copy, "overlay/extensions/credentials", "bin/extensions/credentials"},
{copy, "overlay/extensions/disconnect", "bin/extensions/disconnect"},
{copy, "overlay/extensions/info", "bin/extensions/info"},
{copy, "overlay/extensions/loglevel", "bin/extensions/loglevel"},
{copy, "overlay/extensions/password", "bin/extensions/password"},
{copy, "overlay/extensions/reload", "bin/extensions/reload"},
{copy, "overlay/extensions/sessions", "bin/extensions/sessions"},
{copy, "overlay/hooks/post_stop", "bin/hooks/post_stop"},
{copy, "overlay/hooks/pre_start", "bin/hooks/pre_start"},
{copy, "overlay/init/openrc/eturnal.confd", "etc/openrc/eturnal.confd"},
{copy, "overlay/logrotate/eturnal", "etc/logrotate.d/eturnal"},
{template, "overlay/eturnalctl", "bin/eturnalctl"},
{template, "overlay/extensions/version", "bin/extensions/version"},
{template, "overlay/init/openrc/eturnal.initd", "etc/openrc/eturnal.initd"},
{template, "overlay/init/sysv/eturnal", "etc/init.d/eturnal"},
{template, "overlay/init/systemd/eturnal.service", "etc/systemd/system/eturnal.service"}]}]}.

{erl_opts,
[{platform_define, "^21\.[0-2]\.", old_persistent_term},
Expand Down Expand Up @@ -161,7 +161,7 @@
% Distribution packaging:
{distro,
[{relx,
[{release, {eturnal, {cmd, "scripts/get-version"}},
[{release, {eturnal, {cmd, "tools/get-version"}},
[eturnal]},
{mode, minimal},
{system_libs, false}]},
Expand All @@ -180,7 +180,7 @@
{layout, edoc_layout_chunks},
{dir, "_build/exdoc+docs/lib/eturnal/doc"}]},
{post_hooks,
[{edoc, "ex_doc eturnal $(scripts/get-version) \\
[{edoc, "ex_doc eturnal $(tools/get-version) \\
\"$REBAR_BUILD_DIR/lib/eturnal/ebin\" \\
--paths '_build/default/lib/*/ebin' \\
--source-ref $(git describe --tags) \\
Expand Down
2 changes: 1 addition & 1 deletion src/eturnal.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, eturnal,
[{description, "STUN/TURN server"},
{vsn, {cmd, "scripts/get-version"}},
{vsn, {cmd, "tools/get-version"}},
{mod, {eturnal_app, []}},
{applications,
[kernel,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/make-binaries → tools/make-binaries
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ then
fi

rel_name='eturnal'
rel_vsn=$(scripts/get-version)
rel_vsn=$(tools/get-version)
rebar_vsn='3.22.0'
crosstool_vsn='1.25.0'
zlib_vsn='1.2.13'
Expand Down
4 changes: 2 additions & 2 deletions scripts/make-containers → tools/make-containers
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fi

# set build variables
rel_name='eturnal'
rel_vsn="$(scripts/get-version)"
rel_vsn="$(tools/get-version)"
tag_vsn="$(echo $rel_vsn | sed -e 's|+|-|')"
tag_minor="$(echo $tag_vsn | sed -e 's|\.| |2' | awk '{{print $1}}')"
tag_major="$(echo $tag_vsn | sed -e 's|\.| |1' | awk '{{print $1}}')"
Expand All @@ -116,7 +116,7 @@ then
if [ ! -f "$PWD/$rel_tarball" ]
then
echo >&2 'This script requires tarballs built for musl-libc with make-binaries script ...'
echo >&2 'Please execute "scripts/make-binaries" with targets "x86_64-linux-musl" and "aarch64-linux-musl" ...'
echo >&2 'Please execute "tools/make-binaries" with targets "x86_64-linux-musl" and "aarch64-linux-musl" ...'
exit 1
fi
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/make-installers → tools/make-installers
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else
fi

rel_name='eturnal'
rel_vsn="$(scripts/get-version)"
rel_vsn="$(tools/get-version)"
rel_dir="/opt/$rel_name"
conf_file="/etc/$rel_name.yml"
tmp_dir=$(mktemp -d "/tmp/.$rel_name.XXXXXX")
Expand Down
2 changes: 1 addition & 1 deletion scripts/make-packages → tools/make-packages
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ then
fi

rel_name='eturnal'
rel_vsn="$(scripts/get-version)"
rel_vsn="$(tools/get-version)"
tmp_dir=$(mktemp -d "/tmp/.$myself.XXXXXX")

trap 'rm -rf "$tmp_dir"' INT TERM EXIT
Expand Down
Loading

0 comments on commit d52cfce

Please sign in to comment.