-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
780 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,48 @@ | ||
FROM nginx:alpine | ||
|
||
LABEL maintainer="realJoshByrnes on Github" | ||
|
||
COPY ./config/openrc-gammu-smsd /etc/init.d/gammu-smsd | ||
|
||
RUN /sbin/apk update && /sbin/apk add --no-cache \ | ||
# Install Gammu-SMSD, PHP8, MariaDB-Client & OpenRC | ||
gammu-smsd php8 php8-fpm php8-mysqli php8-mbstring \ | ||
php8-session php8-ctype openrc mariadb-client tzdata \ | ||
# Set default timezone to Australia/Sydney | ||
&& cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime \ | ||
&& echo "Australia/Sydney" > /etc/timezone \ | ||
&& apk del tzdata \ | ||
# Create required directories | ||
&& /bin/busybox mkdir -p /run/openrc /var/www/install /var/log/gammu \ | ||
# Configure OpenRC | ||
&& /bin/busybox touch /run/openrc/softlevel \ | ||
# Get Kalkun and add to /var/www | ||
&& /bin/busybox wget -qO- https://github.com/realJoshByrnes/Kalkun/tarball/master | \ | ||
/bin/busybox tar x -zvf - -C /var/www --strip-components=1 \ | ||
# Create www user | ||
&& /bin/busybox adduser -D -g 'www' www \ | ||
&& /bin/busybox sed -i "s|;listen.owner\s*=\s*nobody|listen.owner = www|g" /etc/php8/php-fpm.d/www.conf \ | ||
&& /bin/busybox sed -i "s|;listen.group\s*=\s*nobody|listen.group = www|g" /etc/php8/php-fpm.d/www.conf \ | ||
&& /bin/busybox sed -i "s|;listen.mode\s*=\s*0660|listen.mode = 0660|g" /etc/php8/php-fpm.d/www.conf \ | ||
&& /bin/busybox sed -i "s|user\s*=\s*nobody|user = www|g" /etc/php8/php-fpm.d/www.conf \ | ||
&& /bin/busybox sed -i "s|group\s*=\s*nobody|group = www|g" /etc/php8/php-fpm.d/www.conf \ | ||
&& /bin/busybox sed -i "s|;chdir\s*=\s/var/www|chdir = /var/www|g" /etc/php8/php-fpm.d/www.conf #uncommenting line \ | ||
&& /bin/busybox sed -i "s|;log_level\s*=\s*notice|log_level = notice|g" /etc/php8/php-fpm.conf #uncommenting line | ||
|
||
COPY ./config/nginx.conf /etc/nginx/nginx.conf | ||
COPY ./config/gammurc /etc/gammurc | ||
COPY ./config/kalkun-daemon.php /var/www/scripts/daemon.php | ||
COPY ./config/kalkun-daemon.sh /var/www/scripts/daemon.sh | ||
COPY ./config/kalkun-database.php /var/www/application/config/database.php | ||
|
||
# Set permissions | ||
RUN /bin/busybox chown -R www:www /var/www \ | ||
&& /bin/busybox chown -R www:www /usr/share/nginx \ | ||
&& /bin/busybox chmod +x /etc/init.d/gammu-smsd \ | ||
&& /bin/busybox chmod +x /var/www/scripts/daemon.sh \ | ||
# Set auto-start | ||
&& /sbin/rc-update add gammu-smsd default \ | ||
&& /sbin/rc-update add php-fpm8 default \ | ||
&& /sbin/rc-update add nginx default | ||
|
||
CMD ["openrc", "default"] |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# docker-gammu-kalkun | ||
A lightweight Gammu-SMSD / Kalkun docker container | ||
|
||
The recommended installation is via docker-compose. |
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,60 @@ | ||
[gammu] | ||
port = /dev/gsm-modem | ||
connection = at115200 | ||
logfile = /var/log/gammu/gammu.log | ||
logformat = textall | ||
|
||
[smsd] | ||
InboxPath = /var/spool/gammu/inbox/ | ||
OutboxPath = /var/spool/gammu/outbox/ | ||
SentSMSPath = /var/spool/gammu/sent/ | ||
ErrorSMSPath = /var/spool/gammu/error/ | ||
InboxFormat = unicode | ||
OutboxFormat = unicode | ||
TransmitFormat = auto | ||
|
||
#Service = files | ||
Service = sql | ||
User = kalkun | ||
Password = kalkun | ||
Host = kalkun-db | ||
Database = kalkun | ||
Driver = native_mysql | ||
SQL = mysql | ||
|
||
#PIN = | ||
#NetworkCode = | ||
#PhoneCode = | ||
LogFile = /var/log/gammu/smsd.log | ||
LogFacility = daemon | ||
debugLevel = 4 | ||
CommTimeout = 30 | ||
SendTimeout = 30 | ||
MaxRetries = 1 | ||
RetryTimeout = 600 | ||
ReceiveFrequency = 15 | ||
StatusFrequency = 60 | ||
LoopSleep = 1 | ||
MultipartTimeout = 600 | ||
CheckSecurity = 0 | ||
HangupCalls = 1 | ||
CheckBattery = 1 | ||
CheckSignal = 1 | ||
CheckNetwork = 1 | ||
ResetFrequency = 0 | ||
HardResetFrequency = 0 | ||
DeliveryReport = sms | ||
DeliveryReportDelay = 7200 | ||
#PhoneID = ? | ||
#SMSC = +614xxyyyzzz | ||
RunOnReceive = /var/www/scripts/daemon.sh | ||
#RunOnFailure = | ||
#RunOnSent = | ||
#RunOnIncomingCall = | ||
#IncludeNumbersFile = | ||
#ExcludeNumbersFile = | ||
#IncludeSMSCFile | ||
#ExcludeSMSCFile | ||
BackendRetries = 10 | ||
Send = True | ||
Receive = 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,10 @@ | ||
<?php | ||
// Make sure it's run from CLI | ||
if(php_sapi_name() != 'cli' && !empty($_SERVER['REMOTE_ADDR'])) exit("Access Denied."); | ||
|
||
// Please configure this | ||
$url = "http://localhost"; | ||
|
||
fclose(fopen($url."/index.php/daemon/message_routine/", "r")); | ||
|
||
?> |
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,8 @@ | ||
#!/bin/sh | ||
|
||
# Configure this (use absolute path) | ||
PHP=/usr/bin/php8 # php cli path | ||
DAEMON=/var/www/scripts/daemon.php # daemon.php path | ||
|
||
# Execute | ||
$PHP $DAEMON |
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,24 @@ | ||
<?php | ||
if (!defined('BASEPATH')) exit('No direct script access allowed'); | ||
|
||
$active_group = "default"; | ||
$active_record = TRUE; | ||
|
||
$db['default']['hostname'] = "kalkun-db"; | ||
|
||
// MySQL | ||
$db['default']['username'] = "kalkun"; | ||
$db['default']['password'] = "kalkun"; | ||
$db['default']['database'] = "kalkun"; | ||
$db['default']['dbdriver'] = "mysqli"; | ||
|
||
$db['default']['dbprefix'] = ""; | ||
$db['default']['pconnect'] = FALSE; | ||
$db['default']['db_debug'] = TRUE; | ||
$db['default']['cache_on'] = FALSE; | ||
$db['default']['cachedir'] = ""; | ||
$db['default']['char_set'] = "utf8"; | ||
$db['default']['dbcollat'] = "utf8_general_ci"; | ||
|
||
/* End of file database.php */ | ||
/* Location: ./application/config/database.php */ |
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 @@ | ||
user www; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
root /var/www; | ||
|
||
#charset koi8-r; | ||
#access_log /var/log/nginx/host.access.log main; | ||
|
||
location / { | ||
index index.html index.htm index.php; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
# | ||
#location ~ \.php$ { | ||
# proxy_pass http://127.0.0.1; | ||
#} | ||
|
||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
# | ||
# location ~ ^(.+\.php)(.*)$ { | ||
# try_files $uri =404; | ||
# fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
# fastcgi_pass 127.0.0.1:9000; | ||
# fastcgi_index index.php; | ||
# include fastcgi_params; | ||
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
# fastcgi_param PATH_INFO $fastcgi_path_info; | ||
# } | ||
|
||
location ~ ^(.+\.php)(.*)$ { | ||
root /var/www; | ||
fastcgi_split_path_info ^(.+\.php)(.*)$; | ||
fastcgi_pass 127.0.0.1:9000; | ||
fastcgi_index index.php; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} | ||
} |
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,10 @@ | ||
#!/sbin/openrc-run | ||
|
||
# Gammu SMS Daemon | ||
pidfile="/var/run/$RC_SVCNAME.pid" | ||
command="/usr/bin/gammu-smsd" | ||
command_args="-d -p /var/run/$RC_SVCNAME.pid -c /etc/gammurc" | ||
|
||
depend() { | ||
need root localmount | ||
} |
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 @@ | ||
FROM mariadb | ||
ADD gammu.sql /docker-entrypoint-initdb.d | ||
ADD kalkun.sql /docker-entrypoint-initdb.d |
Oops, something went wrong.