Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker #2

Merged
merged 56 commits into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
75db72b
Commit inicial
yolile Jan 23, 2018
2a093af
Merge branch 'master' of github.com:socialappslab/appcivist-docker-co…
yolile Jan 23, 2018
301d3ee
Add front end confs
yolile Jan 24, 2018
acea722
rename and add backend deploy.sh
yolile Jan 24, 2018
3bd5d4f
correct frontend and backend paths
yolile Jan 25, 2018
ec76b49
add voting api
yolile Jan 26, 2018
a381148
update voting-api
yolile Jan 26, 2018
f5d6bd9
finish voting api
yolile Jan 27, 2018
b85fa51
add etherpad lite
yolile Jan 27, 2018
41dbee5
change etherpad image
yolile Jan 28, 2018
839a005
add apache2 config
yolile Jan 29, 2018
f612428
add usnb
yolile Jan 29, 2018
e27e7e2
usbn
yolile Jan 30, 2018
0cf2905
add usnb services
yolile Feb 1, 2018
92a1971
add postgres and mongo
yolile Feb 1, 2018
786fac6
update volumes dir
yolile Feb 2, 2018
b1379e7
front end permissions
yolile Feb 2, 2018
207e450
fix permissions
yolile Feb 2, 2018
c2d939c
remove usnb files before deploy
yolile Feb 2, 2018
a237f50
fix permissions
yolile Feb 2, 2018
58b4e11
apache conf
yolile Feb 2, 2018
11baf71
add postgres conf
yolile Feb 2, 2018
ea9d15c
test config
yolile Feb 3, 2018
828010a
apache conf
yolile Feb 3, 2018
745e3d5
apache conf
yolile Feb 3, 2018
8aa6b6e
configs
yolile Feb 3, 2018
8ffbaa9
add depends on
yolile Feb 3, 2018
956d49b
add docker compose version
yolile Feb 3, 2018
4647aab
add links
yolile Feb 3, 2018
1de4bcd
docker compose migration
yolile Feb 3, 2018
0258de5
quit depends on
yolile Feb 3, 2018
a9458f9
apache conf
yolile Feb 3, 2018
6e77373
apache config
yolile Feb 3, 2018
80f70f1
apache confs
yolile Feb 3, 2018
d0dc0c1
apache conf
yolile Feb 3, 2018
5ace6d9
apache conf
yolile Feb 3, 2018
6787cd0
apache configs
yolile Feb 3, 2018
ea92836
apache conf
yolile Feb 3, 2018
8348a78
apache conf
yolile Feb 3, 2018
c8a2881
apache2 config
yolile Feb 3, 2018
2d1abfe
apache conf
yolile Feb 3, 2018
c8f5a9d
apache confs
yolile Feb 3, 2018
9fc5015
add file server
yolile Feb 6, 2018
14e7cdd
Refactor of pass and user variables
yolile Feb 7, 2018
98b0fd1
add gitignore
yolile Feb 7, 2018
e1cc00e
add log and deploy scripts
yolile Feb 7, 2018
df97a20
add abiword in etherpad lite
yolile Feb 7, 2018
231f203
deploy all directory
yolile Feb 7, 2018
5986c5b
update env sample
yolile Feb 7, 2018
91dfa59
remove unsed env variable
yolile Feb 7, 2018
823ef11
correct paths
yolile Feb 7, 2018
0f41a52
add pgagent to postgres
yolile Feb 8, 2018
61e096c
Merge branch 'docker' of github.com:socialappslab/appcivist-docker-co…
yolile Feb 8, 2018
15d8f24
update postgres dockerfile
yolile Feb 8, 2018
c04baae
update dockerfile
yolile Feb 8, 2018
ec340f9
add install -y pgagent
yolile Feb 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
RABBITMQ_DEFAULT_USER=user
RABBITMQ_DEFAULT_PASS=pass
ETHERPAD_DB_TYPE=postgres
ETHERPAD_DB_HOST=localhost
ETHERPAD_DB_USER=postgres
ETHERPAD_DB_PASSWORD=postgres
ETHERPAD_DB_NAME=etherpad_appcivist
POSTGRES_PASSWORD=postgres
POSTGRES_USER=appcivist
POSTGRES_DB=appcivist
VOTING_API_SECRET=secret
USNB_EMAIL_HOST=''
USNB_EMAIL_PORT=''
USNB_EMAIL_USER=''
USNB_EMAIL_PASSWORD=''
USNB_FACEBOOK_USER=''
USNB_FACEBOOK_PASSWORD=''
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
.idea/
26 changes: 26 additions & 0 deletions appcivist-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM openjdk:8
MAINTAINER Cristhian Parra <[email protected]>
ENV PROJECT_HOME /home/appcivist/production/appcivist-platform

# Create editor userspace
RUN groupadd appcivist
RUN useradd appcivist -m -g appcivist -s /bin/bash
RUN passwd -d -u appcivist
RUN apt-get update && apt-get install sudo
RUN echo "appcivist ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/appcivist
RUN chmod 0440 /etc/sudoers.d/appcivist
RUN mkdir -p ${PROJECT_HOME}
RUN mkdir -p /opt/appcivist/files
RUN chown appcivist:appcivist /opt/appcivist/files
RUN chown appcivist:appcivist ${PROJECT_HOME}
ADD appcivist-backend /etc/init.d/appcivist-backend
RUN chmod 777 /etc/init.d/appcivist-backend
USER appcivist
#Add init script

# Expose play ports 9000 default 9999 debug 8888 activator ui
EXPOSE 9000
EXPOSE 9999
EXPOSE 8888
#build the project and start it
WORKDIR ${PROJECT_HOME}
104 changes: 104 additions & 0 deletions appcivist-backend/appcivist-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/sh

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/appcivist/appcivist-backend.log"
APPCIVIST_BCK_DIR="/home/appcivist/production/appcivist-platform"
APPCIVIST_BCK_BIN="target/universal/stage/bin/appcivist-core"
USER="appcivist"
GROUP="appcivist"
DESC="AppCivist Backend"
NAME="appcivist-core"

### BEGIN INIT INFO
# Provides: appcivist-backend
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts appcivist server
# Description: starts appcivist server using start-stop-daemon
### END INIT INFO


set -e

. /lib/lsb/init-functions

start() {
if [ -f $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID ]; then
rm $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID
fi
echo "Starting $DESC... "
start-stop-daemon -v --start --chuid "$USER:$GROUP" --exec $APPCIVIST_BCK_DIR/$APPCIVIST_BCK_BIN
echo "done"
}

#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}

stop() {
echo "Stopping $DESC... "
echo "Testing $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID"

# if [ -f $APPCIVIST_BCK_DIR/$NAME-play.pid ]; then
# echo "PID file found $APPCIVIST_BCK_DIR/$NAME-play.pid"
# echo "Killing process tree /proc/`cat $APPCIVIST_BCK_DIR/$NAME-play.pid`"
# while [ -d /proc/$(cat $APPCIVIST_BCK_DIR/$NAME-play.pid) ]; do
# echo "Killing process `cat $APPCIVIST_BCK_DIR/$NAME-play.pid`"
# killtree $(cat $APPCIVIST_BCK_DIR/$NAME-play.pid) 15
# sleep 0.5
# done
# rm $APPCIVIST_BCK_DIR/$NAME-play.pid
# fi
# echo "done"
if [ ! -f $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID ]
then
echo "$APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID does not exist, process is not running"
exit 1
else
echo "PID file found $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID"
echo "Killing process tree /proc/`cat $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID`"
kill `cat $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID`;
rm -f $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID;
echo "$NAME stopped"

#while [ -d /proc/$(cat $APPCIVIST_BCK_DIR/$NAME-play.pid) ]; do
# echo "Killing process `cat $APPCIVIST_BCK_DIR/$NAME-play.pid`"
# killtree $(cat $APPCIVIST_BCK_DIR/$NAME-play.pid) 15
# sleep 0.5
#done
fi
}

status() {
status_of_proc -p $APPCIVIST_BCK_DIR/target/universal/stage/RUNNING_PID "" "appcivist-backend" && exit 0 || exit $?
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac

exit 0
2 changes: 2 additions & 0 deletions appcivist-backend/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
/home/appcivist/production/appcivist-platform/./activator stage && /etc/init.d/appcivist-backend start
31 changes: 31 additions & 0 deletions appcivist-frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM digitallyseamless/nodejs-bower-grunt
MAINTAINER Cristhian Parra <[email protected]>
ENV PROJECT_HOME /home/appcivist/production/appcivist-pb-client

RUN groupadd appcivist
RUN useradd appcivist -m -g appcivist -s /bin/bash
RUN passwd -d -u appcivist
RUN apt-get update && apt-get install sudo
RUN echo "appcivist ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/appcivist
RUN chmod 0440 /etc/sudoers.d/appcivist

RUN apt-get install -y ruby ruby-dev
RUN gem update --system
RUN gem install compass
RUN gem install sass
RUN mkdir -p ${PROJECT_HOME}
RUN mkdir -p /opt/appcivist/files
RUN chown appcivist:appcivist /opt/appcivist/files
RUN chown appcivist:appcivist ${PROJECT_HOME}
RUN apt-get install -y apache2 git
RUN mkdir /var/www/html/appcivist-pb
RUN chown appcivist:appcivist /var/www/html/appcivist-pb
ADD sites /etc/apache2/sites-available
RUN rm -rf /etc/apache2/mods-enabled
ADD mods-enabled /etc/apache2/mods-enabled
ADD modules /usr/lib/apache2/modules
ADD ssll /root/ssl
RUN chmod 777 -R /home/appcivist/production/appcivist-pb-client/
EXPOSE 8080
ADD deploy.sh deploy.sh
RUN chmod 777 deploy.sh
26 changes: 26 additions & 0 deletions appcivist-frontend/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
source ~/.bashrc
cd /home/appcivist/production/appcivist-pb-client
npm install grunt --save-dev
npm install -f
bower -f update appcivist-patterns
grunt build -f
rm -rf /var/www/html/appcivist-pb/*
cp -rf dist/* /var/www/html/appcivist-pb
sudo service apache2 restart
echo "ServerName testappcivist.org" | sudo tee /etc/apache2/conf-available/fqdn.conf
sudo a2enconf fqdn
sudo service apache2 reload
sudo a2ensite 000-default.conf
sudo service apache2 reload
sudo a2ensite 000-default.vhost.conf
sudo service apache2 reload
sudo a2ensite 000-default.conf
sudo service apache2 reload
sudo a2ensite 111-appcivist-pb.conf
sudo service apache2 reload
sudo a2ensite 222-etherpad.conf
sudo service apache2 reload
sudo a2ensite 333-appcivist-platform.conf
sudo service apache2 reload
sudo service apache2 restart && tail -f /dev/null
2 changes: 2 additions & 0 deletions appcivist-frontend/mods-enabled/access_compat.load
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Depends: authn_core
LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so
24 changes: 24 additions & 0 deletions appcivist-frontend/mods-enabled/alias.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<IfModule alias_module>
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.

Alias /icons/ "/usr/share/apache2/icons/"

<Directory "/usr/share/apache2/icons">
Options FollowSymlinks
AllowOverride None
Require all granted
</Directory>

</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/alias.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
2 changes: 2 additions & 0 deletions appcivist-frontend/mods-enabled/auth_basic.load
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Depends: authn_core
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/authn_core.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/authn_file.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/authz_core.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
2 changes: 2 additions & 0 deletions appcivist-frontend/mods-enabled/authz_host.load
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Depends: authz_core
LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so
2 changes: 2 additions & 0 deletions appcivist-frontend/mods-enabled/authz_user.load
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Depends: authz_core
LoadModule authz_user_module /usr/lib/apache2/modules/mod_authz_user.so
96 changes: 96 additions & 0 deletions appcivist-frontend/mods-enabled/autoindex.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<IfModule mod_autoindex.c>
# Directives controlling the display of server-generated directory listings.

#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
# Remove/replace the "Charset=UTF-8" if you don't use UTF-8 for your filenames.
IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip x-bzip2

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
# It's a suffix rule, so simply matching "core" matches "score" as well !
AddIcon /icons/bomb.gif /core
AddIcon (SND,/icons/sound2.gif) .ogg
AddIcon (VID,/icons/movie.gif) .ogm

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

# Default icons for OpenDocument format
AddIcon /icons/odf6odt-20x22.png .odt
AddIcon /icons/odf6ods-20x22.png .ods
AddIcon /icons/odf6odp-20x22.png .odp
AddIcon /icons/odf6odg-20x22.png .odg
AddIcon /icons/odf6odc-20x22.png .odc
AddIcon /icons/odf6odf-20x22.png .odf
AddIcon /icons/odf6odb-20x22.png .odb
AddIcon /icons/odf6odi-20x22.png .odi
AddIcon /icons/odf6odm-20x22.png .odm

AddIcon /icons/odf6ott-20x22.png .ott
AddIcon /icons/odf6ots-20x22.png .ots
AddIcon /icons/odf6otp-20x22.png .otp
AddIcon /icons/odf6otg-20x22.png .otg
AddIcon /icons/odf6otc-20x22.png .otc
AddIcon /icons/odf6otf-20x22.png .otf
AddIcon /icons/odf6oti-20x22.png .oti
AddIcon /icons/odf6oth-20x22.png .oth

#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
DefaultIcon /icons/unknown.gif

#
# AddDescription allows you to place a short description after a file in
# server-generated indexes. These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz

#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes
ReadmeName README.html
HeaderName HEADER.html

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
IndexIgnore .??* *~ *# RCS CVS *,v *,t

</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/autoindex.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
14 changes: 14 additions & 0 deletions appcivist-frontend/mods-enabled/deflate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
# these are known to be safe with MSIE 6
AddOutputFilterByType DEFLATE text/html text/plain text/xml

# everything else may cause problems with MSIE 6
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/xml
</IfModule>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
2 changes: 2 additions & 0 deletions appcivist-frontend/mods-enabled/deflate.load
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Depends: filter
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
5 changes: 5 additions & 0 deletions appcivist-frontend/mods-enabled/dir.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/dir.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/env.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule env_module /usr/lib/apache2/modules/mod_env.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/filter.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so
1 change: 1 addition & 0 deletions appcivist-frontend/mods-enabled/headers.load
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
Loading