This repository has been archived by the owner on Oct 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hermann Mayer <hermann.mayer92@gmail.com>
- Loading branch information
0 parents
commit 7b2b102
Showing
61 changed files
with
6,953 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = true | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[Makefile] | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*.sh] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.travis/ejabberd* | ||
ebin | ||
tmp | ||
log | ||
*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
language: erlang | ||
otp_release: 20.2 | ||
sudo: true | ||
dist: trusty | ||
|
||
cache: | ||
directories: | ||
- .travis/ejabberd | ||
- tests/node_modules | ||
|
||
stages: | ||
# We want to build and test each and every branch. | ||
- name: build | ||
- name: test | ||
# We just run the release stage, when we have a tag build. | ||
- name: release | ||
if: tag =~ .* AND type IN (push, api) | ||
|
||
jobs: | ||
include: | ||
- stage: build | ||
install: skip | ||
script: | ||
# Reown the build workspace to the travis user (due to Docker, | ||
# and caching) | ||
- sudo chown travis:travis -R $PWD/.. | ||
# Build the ejabberd module | ||
- make -C .travis build | ||
|
||
- stage: test | ||
install: | ||
# Install docker-compose version 1.22.0 | ||
- sudo rm /usr/local/bin/docker-compose | ||
- curl -L http://bit.ly/2B4msDT > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
# Fix some travis/2000 common/1000 user id mapping issues | ||
- source .travis/exe/docker-glue | ||
# Install the test suite dependencies | ||
- make install | ||
script: | ||
- docker --version | ||
- docker-compose --version | ||
- START=background make start reload test | ||
|
||
- stage: release | ||
install: skip | ||
script: | ||
# Reown the build workspace to the travis user (due to Docker, | ||
# and caching) | ||
- sudo chown travis:travis -R $PWD/.. | ||
# Setup the module version environment variable for the release | ||
- export MOD_VERSION=${TRAVIS_TAG} | ||
- \[ -n "${MOD_VERSION}" \] || export MOD_VERSION=latest | ||
# Build and package the ejabberd module | ||
- make -C .travis build package | ||
deploy: | ||
provider: releases | ||
api_key: ${GITHUB_AUTH_TOKEN} | ||
file: .travis/ejabberd-read-markers-${MOD_VERSION}.tar.gz | ||
skip_cleanup: true | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
MAKEFLAGS += --warn-undefined-variables -j1 | ||
SHELL := bash | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DEFAULT_GOAL := all | ||
.DELETE_ON_ERROR: | ||
.SUFFIXES: | ||
.PHONY: package | ||
|
||
# Environment switches | ||
MODULE ?= ejabberd-read-markers | ||
VERSION ?= 18.01 | ||
MOD_VERSION ?= latest | ||
SOURCE_URL ?= https://github.com/processone/ejabberd/archive/$(VERSION).tar.gz | ||
|
||
# Directories | ||
INCLUDE_DIRS ?= ../include | ||
EBIN_DIRS ?= ../ebin | ||
SRC_DIR ?= ../src | ||
|
||
# Host binaries | ||
APTGET ?= apt-get | ||
CD ?= cd | ||
CP ?= cp | ||
ERLC ?= erlc | ||
FIND ?= find | ||
MKDIR ?= mkdir | ||
PWD ?= pwd | ||
SED ?= sed | ||
SUDO ?= sudo | ||
TAR ?= tar | ||
TEST ?= test | ||
WGET ?= wget | ||
|
||
.download-ejabberd-sources: | ||
# Download the ejabberd $(VERSION) sources | ||
@$(TEST) -f ejabberd/autogen.sh || ( \ | ||
$(WGET) -O ejabberd.tar.gz $(SOURCE_URL) && \ | ||
$(MKDIR) -p ejabberd && \ | ||
$(TAR) xf ejabberd.tar.gz -C ejabberd --strip-components=1 \ | ||
) | ||
|
||
.install-ejabberd-build-deps: | ||
# Install the ejabberd $(VERSION) build dependencies | ||
@$(SUDO) $(APTGET) update -y | ||
@$(SUDO) $(APTGET) build-dep -y ejabberd | ||
@$(SUDO) $(APTGET) install -y libssl-dev libyaml-dev libgd-dev libwebp-dev | ||
|
||
.build-ejabberd: | ||
# Build ejabberd $(VERSION) from source | ||
@cd ejabberd && ./autogen.sh && ./configure && $(MAKE) | ||
|
||
.find-deps: | ||
# Find all build dependencies | ||
$(eval INCLUDES = $(addprefix -I ,\ | ||
$(shell $(FIND) `$(PWD)` -type d -name include) $(INCLUDE_DIRS))) | ||
$(eval EBINS = $(addprefix -pa ,\ | ||
$(shell $(FIND) `$(PWD)` -type d -name ebin) $(EBIN_DIRS))) | ||
|
||
install: \ | ||
.download-ejabberd-sources \ | ||
.install-ejabberd-build-deps \ | ||
.build-ejabberd \ | ||
.find-deps | ||
|
||
build: install | ||
# Build $(MODULE) module from source | ||
@$(MKDIR) -p $(EBIN_DIRS) | ||
@$(ERLC) \ | ||
-o $(EBIN_DIRS) \ | ||
$(INCLUDES) \ | ||
$(EBINS) \ | ||
-DLAGER \ | ||
-DNO_EXT_LIB \ | ||
$(SRC_DIR)/*.erl | ||
|
||
package: | ||
# Create a new release package ($(MODULE)-$(MOD_VERSION).tar.gz) | ||
@$(MKDIR) -p package package/{conf,sql} | ||
@$(CP) -r $(EBIN_DIRS) package/ | ||
@$(CP) ../LICENSE ../README.md ../INSTALL.md \ | ||
../mod_read_markers.spec ../CHANGELOG.md \ | ||
package/ | ||
@$(CP) ../config/mod_read_markers.yml package/conf/ | ||
@$(CP) ../config/postgres/99-pg-read-markers.sql package/sql/pg.sql | ||
@$(SED) -i -e '/\\connect/d' -e '/^$$/d' package/sql/pg.sql | ||
@$(CD) package && \ | ||
$(TAR) cfvz ../$(MODULE)-$(MOD_VERSION).tar.gz --owner=0 --group=0 . | ||
@$(RM) -rf package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# | ||
# Add a new glue user with the uid 1000 and add him to the docker and travis | ||
# group. Then add the travis user to the glue group and reload the glue group | ||
# on the current shell session. Then re-own the whole build directory to the | ||
# glue user and group. | ||
# | ||
# @author Hermann Mayer <hermann.mayer92@gmail.com> | ||
|
||
# Setup the glue user | ||
sudo useradd -m -u 1000 -G travis,docker glue | ||
sudo usermod -aG glue travis | ||
|
||
# Reown the build workspace to the glue user | ||
sudo chown glue:travis -R $PWD/.. | ||
|
||
# Ensure correct permissions on the SSH files | ||
sudo chmod 600 ~/.ssh/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## 0.15.0 | ||
|
||
* Initial release of the ejabberd read markers (mod_read_markers) module | ||
* Implementation of the initial concept (IQ handler, automatic unseen messages | ||
increment, database (SQL) backend) | ||
* Added a simple test suite to verify the functional state of the module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level of experience, | ||
nationality, personal appearance, race, religion, or sexual identity and | ||
orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at hermann.mayer92@gmail.com. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM hausgold/ejabberd:18.01 | ||
MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de> | ||
|
||
# Install custom supervisord units | ||
COPY config/supervisor/* /etc/supervisor/conf.d/ | ||
|
||
# Install system packages and the ruby bundles | ||
RUN rm -rf /var/lib/apt/lists/* && \ | ||
apt-get update -yqqq && \ | ||
apt-get install -y \ | ||
build-essential libicu-dev locales sudo curl wget \ | ||
vim bash-completion inotify-tools git libexpat1-dev \ | ||
fakeroot dpkg-dev libssl-dev libyaml-dev libgd-dev libwebp-dev && \ | ||
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen | ||
|
||
# Install nodejs 8 | ||
RUN rm -rf /var/lib/apt/lists/* && \ | ||
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | ||
apt-get install -y nodejs | ||
|
||
# Setup additional build dependencies for ejabberd/erlang | ||
RUN cd /tmp && \ | ||
apt-get source ejabberd && \ | ||
apt-get build-dep -y ejabberd | ||
|
||
# Setup the runtime directories for ejabberd | ||
RUN mkdir /run/ejabberd && chmod ugo+rwx /run/ejabberd | ||
|
||
# Setup a contrib modules directory | ||
RUN mkdir -p /opt/modules.d/sources && \ | ||
chmod ugo+rwx /opt/modules.d | ||
|
||
# Add new app user | ||
RUN mkdir /app && \ | ||
adduser app --home /home/app --shell /bin/bash \ | ||
--disabled-password --gecos "" | ||
COPY config/docker/shell/* /home/app/ | ||
COPY config/docker/shell/* /root/ | ||
RUN chown app:app -R /app /home/app && \ | ||
mkdir -p /home/app/.ssh | ||
|
||
# Set the root password and grant root access to app | ||
RUN echo 'root:root' | chpasswd | ||
RUN echo 'app ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | ||
|
||
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# mod_read_markers Installation | ||
|
||
- [Common notes](#common-notes) | ||
- [Manual installation](#manual-installation) | ||
- [Manual uninstall](#manual-uninstall) | ||
- [Automatic install on Ubuntu/Debian](#automatic-install-on-ubuntudebian) | ||
|
||
## Common notes | ||
|
||
Take care of the mod_read_markers module configuration on you ejabberd config, | ||
otherwise the module won't be started on your instance and you cannot use the | ||
features. The second important note is the database migration. Execute the SQL | ||
statement on your database which was bundled on the binary relase package. | ||
|
||
## Manual installation | ||
|
||
The ejabberd project is able to compile and load contribution modules at | ||
runtime. You just need to download the source of this module into | ||
`~/.ejabberd-modules` directory or the one defined by the | ||
`CONTRIB_MODULES_PATH` setting in `ejabberdctl.cfg`. There you create a | ||
directory named `mod_read_markers`. | ||
|
||
Then run `ejabberdctl module_install mod_read_markers` while the ejabberd | ||
server is running and you should see a logged info about the read markers | ||
module was started. Then you are able to use it. | ||
|
||
## Manual uninstall | ||
|
||
Just run `ejabberdctl module_uninstall mod_read_markers` while the ejabberd | ||
server is running and delete the `mod_read_markers` directory from your | ||
contribution modules directory (`~/.ejabberd-modules`). | ||
|
||
## Automatic install on Ubuntu/Debian | ||
|
||
Be sure that the `ejabberd` package is installed correctly via `apt`. Then you | ||
can use the following curl-pipe command to automatically install the module to | ||
the ejabberd server. The server MUST be restarted afterwards. |
Oops, something went wrong.