-
Notifications
You must be signed in to change notification settings - Fork 0
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 <[email protected]>
- Loading branch information
0 parents
commit 0ecc2ce
Showing
53 changed files
with
4,749 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-mam2sidekiq-${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,87 @@ | ||
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-mam2sidekiq | ||
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 --enable-redis \ | ||
&& ./rebar get-deps && $(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 | ||
@$(CP) -r $(EBIN_DIRS) package/ | ||
@$(CP) ../LICENSE ../README.md ../INSTALL.md \ | ||
../mod_mam2sidekiq.spec ../CHANGELOG.md \ | ||
package/ | ||
@$(CP) ../config/mod_mam2sidekiq.yml package/conf/ | ||
@$(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 <[email protected]> | ||
|
||
# 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,3 @@ | ||
## 0.1.0 | ||
|
||
* Implemented the basic MAM to Sidekiq bridge |
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 [email protected]. 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,48 @@ | ||
FROM hausgold/ejabberd:18.01 | ||
MAINTAINER Hermann Mayer <[email protected]> | ||
|
||
# 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/* && \ | ||
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list && \ | ||
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 \ | ||
erlang-redis-client && \ | ||
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen | ||
|
||
# Install nodejs 10 | ||
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,36 @@ | ||
# mod_mam2sidekiq 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_mam2sidekiq module configuration on you ejabberd config, | ||
otherwise the module won't be started on your instance and you cannot use the | ||
features. | ||
|
||
## 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_mam2sidekiq`. | ||
|
||
Then run `ejabberdctl module_install mod_mam2sidekiq` while the ejabberd | ||
server is running and you should see a logged info about the message bridge | ||
module was started. Then you are able to use it. | ||
|
||
## Manual uninstall | ||
|
||
Just run `ejabberdctl module_uninstall mod_mam2sidekiq` while the ejabberd | ||
server is running and delete the `mod_mam2sidekiq` 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. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 HAUSGOLD | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.