Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
Restyaboard
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Ali Arshad
Restyaboard
Commits
b11e62a2
Commit
b11e62a2
authored
Mar 26, 2017
by
Christophe Angeli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase restyaboard version to v0.4.2
parent
af45c7cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
187 additions
and
101 deletions
+187
-101
Dockerfile
Dockerfile
+62
-26
README.md
README.md
+21
-11
docker-compose.yml
docker-compose.yml
+54
-31
docker-entrypoint.sh
docker-entrypoint.sh
+50
-33
No files found.
Dockerfile
View file @
b11e62a2
FROM
debian:
wheezy-backports
FROM
debian:
stretch
ARG
TERM=linux
ARG
DEBIAN_FRONTEND=noninteractive
# restyaboard version
ENV
restyaboard_version=v0.2.1
ENV
RESTYABOARD_VERSION=v0.4.2 \
ROOT_DIR=/usr/share/nginx/html \
CONF_FILE=/etc/nginx/conf.d/restyaboard.conf \
SMTP_DOMAIN=localhost \
SMTP_USERNAME=root \
SMTP_PASSWORD=root \
SMTP_SERVER=localhost \
SMTP_PORT=465
# update & install package
RUN
apt-get update
--yes
RUN
apt-get install
--yes
zip curl cron postgresql nginx
RUN
apt-get install
--yes
php5 php5-fpm php5-curl php5-pgsql php5-imagick libapache2-mod-php5
RUN
echo
"postfix postfix/mailname string example.com"
| debconf-set-selections
\
&&
echo
"postfix postfix/main_mailer_type string 'Internet Site'"
| debconf-set-selections
\
&&
apt-get install
-y
postfix
RUN
apt-get update
&&
\
echo
"postfix postfix/mailname string localhost"
| debconf-set-selections
&&
\
echo
"postfix postfix/main_mailer_type string 'Internet Site'"
| debconf-set-selections
&&
\
TERM
=
linux
DEBIAN_FRONTEND
=
noninteractive apt-get install
-y
\
cron
\
curl
\
imagemagick
\
jq
\
libpq5
\
nginx
\
php7.0
\
php7.0-cli
\
php7.0-common
\
php7.0-curl
\
php7.0-fpm
\
php7.0-imagick
\
php7.0-imap
\
php7.0-ldap
\
php7.0-mbstring
\
php7.0-pgsql
\
php7.0-xml
\
postfix
\
postgresql-client
\
unzip
# deploy app
RUN
curl
-L
-o
/tmp/restyaboard.zip https://github.com/RestyaPlatform/board/releases/download/
${
restyaboard_version
}
/board-
${
restyaboard_version
}
.zip
\
&&
unzip /tmp/restyaboard.zip
-d
/usr/share/nginx/html
\
&&
rm /tmp/restyaboard.zip
RUN
curl
-L
-s
-o
/tmp/restyaboard.zip https://github.com/RestyaPlatform/board/releases/download/
${
RESTYABOARD_VERSION
}
/board-
${
RESTYABOARD_VERSION
}
.zip
&&
\
unzip /tmp/restyaboard.zip
-d
${
ROOT_DIR
}
&&
\
rm /tmp/restyaboard.zip
# extensions
RUN
curl
-L
-s
-o
/tmp/apps.json https://raw.githubusercontent.com/RestyaPlatform/board-apps/master/apps.json
&&
\
chmod
-R
go+w /tmp/apps.json
&&
\
mkdir
-p
"
${
ROOT_DIR
}
/client/apps"
&&
\
for
fid
in
$(
jq
-r
'.[] | .id + "-v" + .version'
/tmp/apps.json
)
;
\
do
\
curl
-L
-s
-G
-o
/tmp/
$fid
.zip https://github.com/RestyaPlatform/board-apps/releases/download/v1/
$fid
.zip
;
\
file /tmp/
$fid
.zip |
grep
Zip
&&
unzip /tmp/
$fid
.zip
-d
"
${
ROOT_DIR
}
/client/apps"
;
\
rm /tmp/
$fid
.zip
;
\
done
&&
\
rm /tmp/apps.json
# setting app
WORKDIR
/usr/share/nginx/html
RUN
cp
-R
media /tmp/
\
&&
cp restyaboard.conf /etc/nginx/conf.d
\
&&
sed
-i
's/^.*listen.mode = 0660$/listen.mode = 0660/'
/etc/php5/fpm/pool.d/www.conf
\
&&
sed
-i
's|^.*fastcgi_pass.*$|fastcgi_pass unix:/var/run/php5-fpm.sock;|'
/etc/nginx/conf.d/restyaboard.conf
\
&&
sed
-i
-e
"/fastcgi_pass/a fastcgi_param HTTPS 'off';"
/etc/nginx/conf.d/restyaboard.conf
WORKDIR
${ROOT_DIR}
RUN
rm /etc/nginx/sites-enabled/default
&&
\
cp restyaboard.conf
${
CONF_FILE
}
&&
\
sed
-i
"s/server_name.*
$/
server_name
\"
localhost
\"
;/"
${
CONF_FILE
}
&&
\
sed
-i
"s|listen 80.*
$|
listen 80;|"
${
CONF_FILE
}
&&
\
sed
-i
"s|root.*html|root
${
ROOT_DIR
}
|"
${
CONF_FILE
}
&&
\
chown
-R
www-data:www-data
.
&&
\
chmod
-R
777 media
&&
\
chmod
-R
777 client/img
&&
\
chmod
-R
777 tmp
# volume
VOLUME
/usr/share/nginx/html/media
# cleanup
RUN
apt-get autoremove
-y
--purge
&&
\
apt-get clean
# entry point
COPY
docker-entrypoint.sh /
RUN
chmod +x /docker-entrypoint.sh
ENTRYPOINT
["/docker-entrypoint.sh"]
CMD
["start"]
# expose port
EXPOSE
80
README.md
View file @
b11e62a2
...
...
@@ -13,12 +13,21 @@ Build Restyaboard in Docker.
Quick Start
------------------------------
Build image and Run container using docker-compose.
Build image and Run container
s
using docker-compose.
```
bash
git clone https://github.com/
namikingsoft
/docker-restyaboard.git
git clone https://github.com/
cangeli
/docker-restyaboard.git
cd
docker-restyaboard
```
Edit docker-compose.yml and modify the environment variables to suit your needs.
There are default values for the SMTP configuration,
so you can delete those SMTP_
*
variables if you don't need this feature.
Also, you can choose to delete the local backup service (based on https://hub.docker.com/r/prodrigestivill/postgres-backup-local/).
```
bash
docker-compose up
-d
```
...
...
@@ -42,11 +51,11 @@ Password: restya
Change Restyaboard Version
------------------------------
Edit
restyaboard/Dockerfile.
Available version
is
https://github.com/RestyaPlatform/board/releases
Edit
Dockerfile.
Available version
on
https://github.com/RestyaPlatform/board/releases
```
ENV
restyaboard_version
=REPLACE_ME
ENV
RESTYABOARD_VERSION
=REPLACE_ME
```
In case of upgrade version, rebuild image and recreate container.
...
...
@@ -62,13 +71,14 @@ If you want to upgrade database, e.g.
```
sh
docker-compose run
--rm
restyaboard bash
export
PGHOST
=
$POSTGRES_PORT_5432_TCP_ADDR
export
PGPORT
=
$POSTGRES_PORT_5432_TCP_PORT
export
PGUSER
=
$POSTGRES_ENV_POSTGRES_USER
export
PGPASSWORD
=
$POSTGRES_ENV_POSTGRES_PASSWORD
export
PGHOST
=
${
POSTGRES_HOST
}
export
PGPORT
=
5432
export
PGUSER
=
${
POSTGRES_USER
}
export
PGPASSWORD
=
${
POSTGRES_PASSWORD
}
export
PGDATABASE
=
${
POSTGRES_DB
}
...
psql
-
d
restyaboard
-f
sql/upgrade-0.1.3-0.1.4
.sql
psql
-
d
restyaboard
-f
sql/upgrade-0.1.4-0.1.5
.sql
psql
-
f
sql/upgrade-0.4.2-0.4.3
.sql
psql
-
f
sql/upgrade-0.4.3-0.4.4
.sql
...
exit
```
...
...
docker-compose.yml
View file @
b11e62a2
data
:
image
:
busybox
volumes
:
-
/usr/share/elasticsearch/data
-
/var/lib/postgresql/data
-
/usr/share/nginx/html/media
command
:
tail -f /dev/null
restart
:
always
version
:
'
2'
elasticsearch
:
image
:
elasticsearch
volumes_from
:
-
data
restart
:
always
services
:
postgres
:
image
:
postgres
environment
:
POSTGRES_USER
:
postgres
POSTGRES_PASSWORD
:
something
volumes_from
:
-
data
restart
:
always
restyaboard
:
build
:
.
image
:
restyaboard:4.0.2
ports
:
-
1234:80
volumes
:
-
/var/opt/restya/media:/usr/share/nginx/html/media
environment
:
-
POSTGRES_HOST=postgres
-
POSTGRES_USER=admin
-
POSTGRES_PASSWORD=admin
-
POSTGRES_DB=restyaboard
depends_on
:
-
postgres
networks
:
-
restya-net
restart
:
always
restyaboard
:
build
:
.
links
:
-
elasticsearch:elasticsearch
-
postgres:postgres
ports
:
-
1234:80
volumes_from
:
-
data
restart
:
always
postgres
:
image
:
postgres:9.6
ports
:
-
"
5432:5432"
environment
:
-
POSTGRES_HOST=postgres
-
POSTGRES_USER=admin
-
POSTGRES_PASSWORD=admin
-
POSTGRES_DB=restyaboard
networks
:
-
restya-net
restart
:
always
backup
:
image
:
prodrigestivill/postgres-backup-local
volumes
:
-
/var/opt/restya/pgbackups:/backups
environment
:
-
POSTGRES_HOST=postgres
-
POSTGRES_USER=admin
-
POSTGRES_PASSWORD=admin
-
POSTGRES_DB=restyaboard
-
POSTGRES_EXTRA_OPTS=-Z9 --schema=public --blobs
-
SCHEDULE=@every 2h
-
BACKUP_KEEP_DAYS=2
-
BACKUP_KEEP_WEEKS=4
-
BACKUP_KEEP_MONTHS=6
depends_on
:
-
postgres
networks
:
-
restya-net
restart
:
always
networks
:
restya-net
:
docker-entrypoint.sh
View file @
b11e62a2
#!/bin/bash
set
-e
if
[
"
$1
"
=
'start'
]
;
then
# config
sed
-i
"s/^.*'R_DB_
NAME'.*
$/
define('R_DB_NAME', 'restyaboard
');/g"
\
/usr/share/nginx/html
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
USER'.*
$/
define('R_DB_USER', '
${
POSTGRES_ENV_POSTGRES_USER
}
');/g"
\
/usr/share/nginx/html
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
PASSWORD'.*
$/
define('R_DB_PASSWORD', '
${
POSTGRES_ENV_POSTGRES_PASSWORD
}
');/g"
\
/usr/share/nginx/html
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
HOST'.*
$/
define('R_DB_HOST', '
${
POSTGRES_PORT_5432_TCP_ADDR
}
');/g"
\
/usr/share/nginx/html
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
PORT'.*
$/
define('R_DB_PORT', '
${
POSTGRES_PORT_5432_TCP_PORT
}
');/g"
\
/usr/share/nginx/html
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
HOST'.*
$/
define('R_DB_HOST', '
${
POSTGRES_HOST
}
');/g"
\
${
ROOT_DIR
}
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
PORT'.*
$/
define('R_DB_PORT', '5432
');/g"
\
${
ROOT_DIR
}
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
USER'.*
$/
define('R_DB_USER', '
${
POSTGRES_USER
}
');/g"
\
${
ROOT_DIR
}
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
PASSWORD'.*
$/
define('R_DB_PASSWORD', '
${
POSTGRES_PASSWORD
}
');/g"
\
${
ROOT_DIR
}
/server/php/config.inc.php
sed
-i
"s/^.*'R_DB_
NAME'.*
$/
define('R_DB_NAME', '
${
POSTGRES_DB
}
');/g"
\
${
ROOT_DIR
}
/server/php/config.inc.php
# cron shell
chmod +x /usr/share/nginx/html/server/php/shell/
*
.sh
echo
'*/5 * * * * php /usr/share/nginx/htmlserver/php/shell/indexing_to_elasticsearch.sh'
>
/var/spool/cron/root
echo
'*/5 * * * * php /usr/share/nginx/htmlserver/php/shell/instant_email_notification.sh'
>
/var/spool/cron/root
echo
'0 * * * * php /usr/share/nginx/htmlserver/php/shell/periodic_email_notification.sh'
>
/var/spool/cron/root
echo
'*/5 * * * * php /usr/share/nginx/htmlserver/php/shell/webhook.sh'
>
/var/spool/cron/root
echo
'*/5 * * * * php /usr/share/nginx/htmlserver/php/shell/card_due_notification.sh'
>
/var/spool/cron/root
echo
'*/5 * * * * php /usr/share/nginx/htmlserver/php/shell/imap.sh'
>
/var/spool/cron/root
# media
cp
-R
/tmp/media /usr/share/nginx/html/
chmod
-R
go+w /usr/share/nginx/html/media
chmod
-R
go+w /usr/share/nginx/html/client/img
# postfix
echo
"[
${
SMTP_SERVER
}
]:
${
SMTP_PORT
}
${
SMTP_USERNAME
}
:
${
SMTP_PASSWORD
}
"
>
/etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
echo
"www-data@
${
SMTP_DOMAIN
}
${
SMTP_USERNAME
}
"
>
/etc/postfix/sender_canonical
postmap /etc/postfix/sender_canonical
sed
-i
'/mydomain.*/d'
/etc/postfix/main.cf
sed
-i
'/myhostname.*/d'
/etc/postfix/main.cf
sed
-i
'/myorigin.*/d'
/etc/postfix/main.cf
sed
-i
'/mydestination.*/d'
/etc/postfix/main.cf
sed
-i
"
$
a mydomain =
${
SMTP_DOMAIN
}
"
/etc/postfix/main.cf
sed
-i
"
$
a myhostname = localhost"
/etc/postfix/main.cf
sed
-i
'$ a myorigin = $mydomain'
/etc/postfix/main.cf
sed
-i
'$ a mydestination = localhost, $myhostname, localhost.$mydomain'
/etc/postfix/main.cf
sed
-i
'$ a sender_canonical_maps = hash:/etc/postfix/sender_canonical'
/etc/postfix/main.cf
sed
-i
"s/relayhost =.*
$/
relayhost = [
${
SMTP_SERVER
}
]:
${
SMTP_PORT
}
/"
/etc/postfix/main.cf
sed
-i
'/smtp_.*/d'
/etc/postfix/main.cf
sed
-i
'$ a smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache'
/etc/postfix/main.cf
sed
-i
'$ a smtp_sasl_auth_enable = yes'
/etc/postfix/main.cf
sed
-i
'$ a smtp_sasl_security_options = noanonymous'
/etc/postfix/main.cf
sed
-i
'$ a smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
/etc/postfix/main.cf
sed
-i
'$ a smtp_use_tls = yes'
/etc/postfix/main.cf
sed
-i
'$ a smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt'
/etc/postfix/main.cf
sed
-i
'$ a smtp_tls_wrappermode = yes'
/etc/postfix/main.cf
sed
-i
'$ a smtp_tls_security_level = encrypt'
/etc/postfix/main.cf
# init db
export
PGHOST
=
$POSTGRES_PORT_5432_TCP_ADDR
export
PGPORT
=
$POSTGRES_PORT_5432_TCP_PORT
export
PGUSER
=
$POSTGRES_ENV_POSTGRES_USER
export
PGPASSWORD
=
$POSTGRES_ENV_POSTGRES_PASSWORD
export
PGHOST
=
${
POSTGRES_HOST
}
export
PGPORT
=
5432
export
PGUSER
=
${
POSTGRES_USER
}
export
PGPASSWORD
=
${
POSTGRES_PASSWORD
}
export
PGDATABASE
=
${
POSTGRES_DB
}
set
+e
while
:
do
...
...
@@ -43,15 +55,21 @@ if [ "$1" = 'start' ]; then
fi
sleep 1
done
psql
-c
"CREATE DATABASE restyaboard ENCODING 'UTF8'"
if
[
"
$?
"
=
0
]
;
then
psql
-d
restyaboard
-f
/usr/share/nginx/html/sql/restyaboard_with_empty_data.sql
if
[
"
$(
psql
-c
'\d'
)
"
=
"No relations found."
]
;
then
psql
-f
"
${
ROOT_DIR
}
/sql/restyaboard_with_empty_data.sql"
fi
set
-e
# cron shell
echo
"*/5 * * * *
${
ROOT_DIR
}
/server/php/shell/instant_email_notification.sh"
>>
/var/spool/cron/crontabs/root
echo
"0 * * * *
${
ROOT_DIR
}
/server/php/shell/periodic_email_notification.sh"
>>
/var/spool/cron/crontabs/root
echo
"*/30 * * * *
${
ROOT_DIR
}
/server/php/shell/imap.sh"
>>
/var/spool/cron/crontabs/root
echo
"*/5 * * * *
${
ROOT_DIR
}
/server/php/shell/webhook.sh"
>>
/var/spool/cron/crontabs/root
echo
"*/5 * * * *
${
ROOT_DIR
}
/server/php/shell/card_due_notification.sh"
>>
/var/spool/cron/crontabs/root
# service start
service cron start
service php
5
-fpm start
service php
7.0
-fpm start
service nginx start
service postfix start
...
...
@@ -60,4 +78,3 @@ if [ "$1" = 'start' ]; then
fi
exec
"
$@
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment