update readme for webpage clients

This commit is contained in:
David Luu 2016-10-25 09:07:08 -07:00
parent 897fecf51f
commit 4469ff31f8
4 changed files with 1 additions and 238 deletions

View File

@ -1,86 +0,0 @@
# can use an alternative base image as well
FROM phusion/baseimage:0.9.19
# set your node version, if desired
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get install -y nodejs
# install other dependencies
# install a local redis server - per http://redis.io/topics/quickstart
RUN curl -O http://download.redis.io/redis-stable.tar.gz
RUN tar xvzf redis-stable.tar.gz
RUN mv redis-stable /opt/redis-stable
# for access to make
RUN apt-get install -y --reinstall build-essential
RUN cd /opt/redis-stable && make && cd ..
RUN rm redis-stable.tar.gz
RUN mkdir -p /etc/redis
RUN mkdir -p /var/redis
# make customizations to the redis conf as needed
RUN mkdir -p /var/redis/6379
RUN cp /opt/redis-stable/utils/redis_init_script /etc/init.d/redis_6379
RUN sed -i -- 's|daemonize no|daemonize yes|g' /opt/redis-stable/redis.conf
RUN sed -i -- 's|pidfile /var/run/redis.pid|pidfile /var/run/redis_6379.pid|g' /opt/redis-stable/redis.conf
#RUN sed -i -- 's|port 6379|port 8080|g' /opt/redis-stable/redis.conf
#RUN sed -i -- 's|loglevel notice|loglevel debug|g' /opt/redis-stable/redis.conf
RUN sed -i -- 's|logfile ""|logfile /var/log/redis_6379.log|g' /opt/redis-stable/redis.conf
RUN sed -i -- 's|dir ./|dir /var/redis/6379|g' /opt/redis-stable/redis.conf
RUN cp /opt/redis-stable/redis.conf /etc/redis/6379.conf
RUN cp /opt/redis-stable/src/redis-server /usr/local/bin/
RUN cp /opt/redis-stable/src/redis-cli /usr/local/bin/
RUN update-rc.d redis_6379 defaults
# now should be able to start redis with: /etc/init.d/redis_6379 start
# install mutt locally, and install it silently/non-interactively
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get install -y mutt
# install a local nginx for reverse proxy / load balancing, or IP rate limiting?
#RUN apt-get update
#RUN apt-get install -y nginx
# any nginx customizations & running as service setup go here...
# TODO: to enable accurate IP rate limiting, the reverse proxy should be configured to set the `X-Real-IP` header
# install screen - in case want to start services manually in background and switch between them as windows via screen
RUN apt-get install -y screen
# Create app directory
RUN mkdir -p /opt/textbelt/
ENV HOME /opt/textbelt/
WORKDIR /opt/textbelt/
COPY package.json /opt/textbelt/
# Install node.js dependencies
RUN apt-get install -y git
RUN npm install
# Bundle app source
COPY . /opt/textbelt/
# (any) textbelt customizations (to save in docker image)
RUN sed -i -- "s|fromAddress = 'foo@bar.com'|fromAddress = 'me@mydomain.com'|g" /opt/textbelt/lib/text.js
#RUN rm /opt/textbelt/lib/text.js--
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# we'll expose default port and then we can port map with docker at runtime
# no need to customize port in here
EXPOSE 9090
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
# now you can use try using the docker image
# - as a server: (then make REST calls to it to send message)
# run command : docker run --rm -it -p 8080:9090 typpo/textbelt node server/app.js
# - as node.js module/client:
# run command: docker run --rm -it typpo/textbelt node
# then copy/paste or type in the code to send message as shown README example
# or run command: docker run --rm -it typpo/textbelt node pathTo/yourScript.js
# assuming your script has the code that calls the textbelt module to send message
# or run command: docker run --rm -it -p 8080:9090 typpo/textbelt bash
# to be taken to the shell for you to debug and test things out
# e.g. start/stop/query redis, nginx, test/use mutt
# run textbelt as module in node shell, node script, or start textbelt server
# NOTE: if you use an external redis server and/or external reverse proxy / load balancer
# you will need to handle the network config and mapping such that the textbelt
# docker container can talk to those servers (which may or may not be in their own docker containers)

View File

@ -89,7 +89,7 @@ Canadian and international support may not be complete. Refer to the list of su
* node.js - [minond/textbelt](https://github.com/minond/textbelt), [ajay-gandhi/textbelt](https://github.com/ajay-gandhi/textbelt), [soondobu/mtextbelt](https://github.com/soondobu/mtextbelt) * node.js - [minond/textbelt](https://github.com/minond/textbelt), [ajay-gandhi/textbelt](https://github.com/ajay-gandhi/textbelt), [soondobu/mtextbelt](https://github.com/soondobu/mtextbelt)
* php - [ctrlaltdylan/courier](https://github.com/ctrlaltdylan/courier), [securingsincity/phpsms](https://github.com/securingsincity/phpsms) * php - [ctrlaltdylan/courier](https://github.com/ctrlaltdylan/courier), [securingsincity/phpsms](https://github.com/securingsincity/phpsms)
* bash - [cfalk/MessageMe](https://github.com/cfalk/MessageMe) * bash - [cfalk/MessageMe](https://github.com/cfalk/MessageMe)
* html/js webpage - [mLuby/SMS](https://github.com/mLuby/SMS) * html/js/mobile webpage - [mLuby/SMS](https://github.com/mLuby/smsHR), [daluu/textbelt-clients](https://github.com/daluu/textbelt-clients)
* Browser extension - [Chrome](https://chrome.google.com/webstore/detail/textbelter/clciehobfheendclpnmbgbalelignpoa), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/textbelter/), [Safari](https://github.com/daluu/textbelt-clients/raw/master/textbelter.safariextz), [Opera](https://addons.opera.com/en/extensions/details/textbelter/?display=en) * Browser extension - [Chrome](https://chrome.google.com/webstore/detail/textbelter/clciehobfheendclpnmbgbalelignpoa), [Firefox](https://addons.mozilla.org/en-US/firefox/addon/textbelter/), [Safari](https://github.com/daluu/textbelt-clients/raw/master/textbelter.safariextz), [Opera](https://addons.opera.com/en/extensions/details/textbelter/?display=en)
* Windows Phone - [TextBelter](https://www.microsoft.com/en-us/store/apps/textbelter/9nblggh1z2dg) * Windows Phone - [TextBelter](https://www.microsoft.com/en-us/store/apps/textbelter/9nblggh1z2dg)
* [SendSMS Mac App](https://itunes.apple.com/app/sendsms/id584131262?mt=12) * [SendSMS Mac App](https://itunes.apple.com/app/sendsms/id584131262?mt=12)

130
Vagrantfile vendored
View File

@ -1,130 +0,0 @@
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
# feel free to rework the vagrant config / build steps as desired...
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.hostname = 'textbelt'
config.vm.box = 'ubuntu/trusty64'
config.ssh.forward_agent = true
config.ssh.insert_key = false
config.ssh.private_key_path = ['~/.ssh/id_rsa', '~/.vagrant.d/insecure_private_key']
config.vm.provider 'virtualbox' do |v|
v.name = config.vm.hostname
v.memory = 1024
end
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.define 'textbelt' do |textbelt|
textbelt.vm.network 'public_network'
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
textbelt.vm.synced_folder '~/textbelt/', '/textbelt'
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
textbelt.vm.provision 'shell', inline: <<-SHELL
# set your node version, if desired
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install -y nodejs
# Install node.js dependencies
apt-get install -y git
# install other dependencies
# install a local redis server - per http://redis.io/topics/quickstart
curl -O http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
mv redis-stable /opt/redis-stable
cd /opt/redis-stable && make && cd ..
rm redis-stable.tar.gz
mkdir -p /etc/redis
mkdir -p /var/redis
# make customizations to the redis conf as needed
mkdir -p /var/redis/6379
cp /opt/redis-stable/utils/redis_init_script /etc/init.d/redis_6379
sed -i -- 's|daemonize no|daemonize yes|g' /opt/redis-stable/redis.conf
sed -i -- 's|pidfile /var/run/redis.pid|pidfile /var/run/redis_6379.pid|g' /opt/redis-stable/redis.conf
#sed -i -- 's|port 6379|port 8080|g' /opt/redis-stable/redis.conf
#sed -i -- 's|loglevel notice|loglevel debug|g' /opt/redis-stable/redis.conf
sed -i -- 's|logfile ""|logfile /var/log/redis_6379.log|g' /opt/redis-stable/redis.conf
sed -i -- 's|dir ./|dir /var/redis/6379|g' /opt/redis-stable/redis.conf
cp /opt/redis-stable/redis.conf /etc/redis/6379.conf
cp /opt/redis-stable/src/redis-server /usr/local/bin/
cp /opt/redis-stable/src/redis-cli /usr/local/bin/
update-rc.d redis_6379 defaults
# now should be able to start redis with: /etc/init.d/redis_6379 start
# install mutt locally, and install it silently/non-interactively
export DEBIAN_FRONTEND=noninteractive
apt-get install -y mutt
# install a local nginx for reverse proxy / load balancing, or IP rate limiting?
#apt-get update
#apt-get install -y nginx
# any nginx customizations & running as service setup go here...
# TODO: to enable accurate IP rate limiting, the reverse proxy should be configured to set the `X-Real-IP` header
# install screen - in case want to start services manually in background and switch between them as windows via screen
apt-get install -y screen
# Clean up APT when done.
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# this should give you a VM with textbelt dependencies installed, and a local redis (and perhaps nginx)
# NOTE: if you use an external redis server and/or external reverse proxy / load balancer
# you will need to handle the network config and mapping such that the textbelt
# VM can talk to those servers (which may or may not be in their own VMs)
SHELL
end
end

View File

@ -1,21 +0,0 @@
#!/bin/sh
remove_existing_config () {
perl -i -0pe 's/^#vagrant-start.*#vagrant-end/ /smg' ~/.ssh/config;
}
add_new_config () {
echo "#vagrant-start" >> ~/.ssh/config;
vagrant ssh-config >> ~/.ssh/config;
echo "#vagrant-end" >> ~/.ssh/config;
# only the owner should have read/write access
chmod 600 ~/.ssh/config;
}
# Empty out previous config values
remove_existing_config
# Update ~/.ssh/config with latest data
add_new_config
echo "Added the Vagrant targets in your ~/.ssh/config file"