0.1.0 • Published 2 years ago

n8n-nodes-tweetnacl v0.1.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
2 years ago

n8n-nodes-tweetnacl

An n8n node to use TweetNaCl.js for encryption and decryption.

Usage

Docker

If you're running n8n via Docker, you will have to create a Docker image with the node module installed in n8n. Follow the steps mentioned below:

  1. Create a Dockerfile and paste the following code
FROM node:14.15-alpine

ARG N8N_VERSION

RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi

# Update everything and install needed dependencies
RUN apk add --update graphicsmagick tzdata git tini su-exec

# # Set a custom user to not have n8n run as root
USER root

# Install n8n and the also temporary all the packages
# it needs to build it correctly.
RUN apk --update add --virtual build-dependencies python build-base ca-certificates && \
	npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} && \
	apk del build-dependencies \
	&& rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root;

# Install n8n-nodes-tweetnacl
RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-tweetnacl

# Install fonts
RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \
	update-ms-fonts && \
	fc-cache -f && \
	apk del fonts && \
	find  /usr/share/fonts/truetype/msttcorefonts/ -type l -exec unlink {} \; \
	&& rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root

ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu

WORKDIR /data

COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]

EXPOSE 5678/tcp
  1. Create a docker-entrypoint.sh file with the following code.
#!/bin/sh

if [ -d /root/.n8n ] ; then
  chmod o+rx /root
  chown -R node /root/.n8n
  ln -s /root/.n8n /home/node/
fi

chown -R node /home/node

if [ "$#" -gt 0 ]; then
  # Got started with arguments
  exec su-exec node "$@"
else
  # Got started without arguments
  exec su-exec node n8n
fi
  1. Create your Docker image
docker build -t n8n-custom .
  1. Start the container
docker run -p 5678:5678 n8n-custom

Navigate to your instance (localhost:5678 if you're running locally) to access the TweetNaCl node.

Other

If you’re running either by installing it globally or via PM2, make sure that you install n8n-nodes-tweetnacl inside n8n. n8n will find the module and load it automatically.

Contributing

To contribute, refer to CONTRIBUTING.md.