diff --git a/apache2.yaml b/apache2.yaml new file mode 100644 index 0000000..28dfeff --- /dev/null +++ b/apache2.yaml @@ -0,0 +1,75 @@ +--- + +- hosts: apache2 + become: yes + vars: + tmpl: + - {file: "static", value: 'Use DocRootVHost "static.rudolf" "/home/www/static"' } + - {file: "syncthing", value: 'Use ProxySSLVHost "syncthing.rudolf" "/" "http://localhost:{{ syncthing_port }}/" "syncthing.rudolf"' } + - {file: "jenkins", value: 'Use ProxySSLVHost "jenkins.rudolf" "/" "http://localhost:{{ jenkins_port }}/" "jenkins.rudolf"' } + # - {file: "torrent", value: 'Use ProxySSLVHost "torrent.rudolf" "/transmission" "http://localhost:9091/transmission" "torrent.rudolf"' } + # - {file: "", value: '# TODO Header edit Location ^http://jenkins.rudolf.com.ua https://jenkins.rudolf.com.ua' } + # - {file: "webmin", value: 'Use ProxySSLVHost "webmin.rudolf" "/" "http://localhost:10000/" "webmin.rudolf"' } + # - {file: "", value: 'Use ProxySSLVHost "bitsync.rudolf" "/" "http://localhost:8888/" "bitsync.rudolf"' } + tasks: + + - name: install apache2 + apt: name=apache2 update_cache=yes state=latest + + - name: apache2 listen on port {{ http_port }} and {{ https_port }} + lineinfile: + dest: /etc/apache2/ports.conf + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" + state: present + with_items: + - { regexp: "^.*Listen {{ http_port }}", line: "Listen {{ http_port }}" } + - { regexp: "^.*Listen {{ https_port }}", line: "Listen {{ https_port }}" } + notify: + - restart apache2 + + - name: macro lib + copy: + src: apache2/macro.conf + dest: /etc/apache2/conf-enabled/macro.conf + notify: + - restart apache2 + + - name: enabling modules + apache2_module: + name: "{{ item }}" + state: present + with_items: + - proxy_http + - rewrite + - macro + # - ssl TODO + notify: + - restart apache2 + + - name: populate templates + template: + src: "{{ item }}" + dest: /etc/apache2/sites-enabled/{{ item | basename }} + with_fileglob: + - apache2/templates/*.conf + notify: + - restart apache2 + + - name: populate proxies + copy: + content: "{{ item.value }}" + dest: "/etc/apache2/sites-enabled/{{ item.file }}.conf" + with_items: tmpl + notify: + - restart apache2 + + - name: apache running + service: + name: apache2 + state: started + enabled: yes + + handlers: + - name: restart apache2 + service: name=apache2 state=restarted diff --git a/apache2/macro.conf b/apache2/macro.conf new file mode 100644 index 0000000..d47b619 --- /dev/null +++ b/apache2/macro.conf @@ -0,0 +1,89 @@ + + + + + ServerAdmin rudolfss13@gmail.com + ServerName $domain.com.ua + + DocumentRoot $documentRoot + + Options FollowSymLinks + AllowOverride None + + + Options Indexes FollowSymLinks MultiViews + AllowOverride None + Order allow,deny + allow from all + + + Use GoogleAuth https://$domain.com.ua/oauth2callback / + + ErrorDocument 404 /404.html + + ErrorLog ${APACHE_LOG_DIR}/error.log + + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/access.log combined + + Use MacroSSL $domain + + + + + + + + + ServerAdmin rudolfss13@gmail.com + ServerName $domain.com.ua + + ProxyPass $proxyPrefix $proxyUrl retry=0 + ProxyPassReverse $proxyPrefix $proxyUrl + + + + + + + + ServerAdmin rudolfss13@gmail.com + ServerName $domain.com.ua + + Use MacroSSL $sslDomain + + ProxyPass $proxyPrefix $proxyUrl retry=0 + ProxyPassReverse $proxyPrefix $proxyUrl + + + + + + + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/$domain.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/$domain.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/$domain.com.ua/chain.pem + + + + + OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration + OIDCClientID 259977835489-5lrmult5iimh3f7dik848fb00mn8td2j.apps.googleusercontent.com + OIDCClientSecret 3xzC51fw-yBeWv63pxYlmYE7 + OIDCRedirectURI $callback + OIDCCryptoPassphrase blabla + OIDCScope "openid email" + OIDCRemoteUserClaim email + + + + AuthType openid-connect + Require valid-user + + + + diff --git a/apache2/templates/default.conf b/apache2/templates/default.conf new file mode 100644 index 0000000..13be420 --- /dev/null +++ b/apache2/templates/default.conf @@ -0,0 +1,31 @@ + + + ServerAdmin rudolfss13@gmail.com + ServerAlias *.rudolf.com.ua + + Redirect 404 / + ErrorDocument 404 "Page Not Found" + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/rudolf.com.ua/chain.pem + + + + ServerAdmin rudolfss13@gmail.com + ServerAlias *.rudolf.com.ua + + RewriteEngine On + RewriteCond %{HTTPS} off + RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} + + + + + + + +## Virtual hosts +Use DocRootVHost "rudolf" "/home/www/root" diff --git a/apache2/templates/smarthome.conf b/apache2/templates/smarthome.conf new file mode 100644 index 0000000..35bd701 --- /dev/null +++ b/apache2/templates/smarthome.conf @@ -0,0 +1,42 @@ + + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/chain.pem + + Use GoogleAuth https://smarthome.rudolf.com.ua/oauth2callback / + + + Require claim email:rudolfss13@gmail.com + Require claim email:malta4ka@gmail.com + + + ProxyPass / http://192.168.17.2:{{ tomcat_port }}/smarthome/ + ProxyPassReverse / http://192.168.17.2:{{ tomcat_port }}/smarthome/ + + + + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + + Order deny,allow + Deny from all + Allow from 192.168.17. + Allow from 5.19.137.112 + + + + ProxyPass / http://192.168.17.2:{{ tomcat_port }}/smarthome/ + ProxyPassReverse / http://192.168.17.2:{{ tomcat_port }}/smarthome/ + + + diff --git a/gogs.yaml b/gogs.yaml index cf716e7..80bc821 100644 --- a/gogs.yaml +++ b/gogs.yaml @@ -27,8 +27,8 @@ volumes: - "/var/gogs:/data" ports: - - "0.0.0.0:80:3000" - - "0.0.0.0:23:22" + - "0.0.0.0:{{ gogs_port }}:3000" + - "0.0.0.0:{{ gogs_ssh }}:22" state: reloaded diff --git a/group_vars/all b/group_vars/all new file mode 100644 index 0000000..976e062 --- /dev/null +++ b/group_vars/all @@ -0,0 +1,11 @@ +gogs_port: 8081 +gogs_ssh: 23 +jenkins_port: 8080 +jenkins_cli: 50000 +tomcat_port: 8888 +syncthing_port: 8384 + + +http_port: 80 +https_port: 443 +domain: rudolf.com.ua diff --git a/hosts b/hosts index 7b0c920..9c24ed3 100644 --- a/hosts +++ b/hosts @@ -2,3 +2,5 @@ serva4og ansible_ssh_user=rudolf ansible_ssh_host=192.168.17.2 pi ansible_ssh_user=pi ansible_ssh_host=192.168.17.3 +[apache2] +serva4og ansible_ssh_user=rudolf ansible_ssh_host=192.168.17.2 diff --git a/jenkins.yaml b/jenkins.yaml new file mode 100644 index 0000000..3d40417 --- /dev/null +++ b/jenkins.yaml @@ -0,0 +1,74 @@ +--- +- hosts: serva4og + vars: + user: rudolf + become: yes + + tasks: + + - name: install packages + apt: name={{ item }} update_cache=yes state=latest + with_items: + - docker.io + - python-docker + - default-jdk + + - name: user {{ user }} + user: + name: "{{ user }}" + groups: docker + append: yes + + - name: jenkins home present + file: + path: /var/jenkins + state: directory + mode: 755 + + - name: copy configs + copy: + src: jenkins/jobs + dest: /var/jenkins + force: no + owner: "{{ user }}" + group: "{{ user }}" + notify: restart jenkins docker + + + - name: run jenkins docker + docker: + name: jenkins + image: jenkins + detach: True + net: default + volumes: + - "/var/jenkins:/var/jenkins_home" + ports: + - "0.0.0.0:{{ jenkins_port }}:8080" + - "0.0.0.0:{{ jenkins_ci }}:50000" + state: reloaded + + - name: install jenkins plugins + shell: "java -jar /var/jenkins/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080/ install-plugin {{ item }}" + with_items: + - git + + become_user: rudolf + + + # - name: Install jenkins plugins + # get_url: + # url: http://updates.jenkins-ci.org/latest/{{ item.name }}.hpi + # dest: /var/jenkins/plugins + # with_items: + # - { name: "git"} + # notify: restart jenkins docker + + + handlers: + - name: restart jenkins docker + docker_container: + name: jenkins + image: jenkins + restart: yes + diff --git a/jenkins/jobs/Deploy_glassfish/config.xml b/jenkins/jobs/Deploy_glassfish/config.xml new file mode 100644 index 0000000..fc2a2b2 --- /dev/null +++ b/jenkins/jobs/Deploy_glassfish/config.xml @@ -0,0 +1,75 @@ + + + + + false + + + + + contextRoot + + + + gau + abacus + gau-1.3 + gau-1.2 + gau_dev + + + + + groupID + + + + docstorage + ua/rudolf/finance + + + + + artifactID + + + + docstorage + ear-std + webclient-interface + + + + + version + + 1.0 + + + type + + + + war + ear + + + + + + + + true + true + false + false + + false + + + /home/glassfish/bin/asadmin --user admin --passwordfile ./pass.txt deploy --force --name=$artifactID --contextroot $contextRoot /home/mvn/repo/$groupID/$artifactID/$version/$artifactID-$version.$type + + + + + \ No newline at end of file diff --git a/jenkins/jobs/Deploy_tomcat/config.xml b/jenkins/jobs/Deploy_tomcat/config.xml new file mode 100644 index 0000000..70a25a7 --- /dev/null +++ b/jenkins/jobs/Deploy_tomcat/config.xml @@ -0,0 +1,104 @@ + + + + + false + + + + -1 + 10 + -1 + -1 + + + + + + contextRoot + + + + test + gau + abacus + gau-1.3 + gau-1.2 + gau_dev + expeng + smarthome + + + + + groupID + + + + ua/rudolf/finance + ua/rudolf/smarthome + docstorage + com/fileproc + + + + + artifactID + + + + webclient-interface + docstorage + ear-std + server + web-ui + + + + + version + + 0.1 + + + type + + + + war + ear + + + + + + + + true + false + false + false + + false + + + rm -rf * +cp /var/lib/jenkins/.m2/repository/$groupID/$artifactID/$version/$artifactID-$version.war $contextRoot.war + + + + + + + deployer + ZGVwbG95ZXI= + http://localhost:8080/ + + + + **/*.war + false + + + + \ No newline at end of file diff --git a/jenkins/jobs/ExpEng/config.xml b/jenkins/jobs/ExpEng/config.xml new file mode 100644 index 0000000..68c62fb --- /dev/null +++ b/jenkins/jobs/ExpEng/config.xml @@ -0,0 +1,120 @@ + + + + + + -1 + 15 + -1 + -1 + + false + + + + + git_revision + + 64a8318a-6501-4006-943d-d4e3e8405fde + PT_BRANCH + + + + + skipTests + + true + + + isDeploy + + false + + + + + + 2 + + + origin + git@rudolf.com.ua:expEng.git + 057bac74-b42d-46d3-9c6f-bb1c81491d93 + + + + + ${git_revision} + + + false + + + + + + + true + false + false + false + + false + + + clean +install + default + false + + + + + + ${isDeploy} + + + + + + + contextRoot=expeng +groupID=com/fileproc +artifactID=server +version=1.0-SNAPSHOT +type=war + + + Deploy_tomcat + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/Finance/config.xml b/jenkins/jobs/Finance/config.xml new file mode 100644 index 0000000..d796132 --- /dev/null +++ b/jenkins/jobs/Finance/config.xml @@ -0,0 +1,161 @@ + + + + + + -1 + 15 + -1 + -1 + + false + + + + + git_revision + + 6625d06b-0157-4798-a5a4-8bb2897a992b + PT_BRANCH + + + + + skipTests + + true + + + runSelenium + + false + + + isDeploy + + false + + + + + + 2 + + + origin + git@rudolf.com.ua:finance.git + 057bac74-b42d-46d3-9c6f-bb1c81491d93 + + + + + ${git_revision} + + + false + + + + + + true + false + false + false + + false + + + clean +install + default + false + + + + + + ${runSelenium} + + + + + + Finance_selenium + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + + ${isDeploy} + + + + + + + contextRoot=abacus +groupID=ua/rudolf/finance +artifactID=webclient-interface +version=0.1 +type=war + + + Deploy_tomcat + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/Finance_selenium/config.xml b/jenkins/jobs/Finance_selenium/config.xml new file mode 100644 index 0000000..df77601 --- /dev/null +++ b/jenkins/jobs/Finance_selenium/config.xml @@ -0,0 +1,69 @@ + + + + + false + + + true + false + false + false + + false + $JENKINS_HOME/jobs/Finance/workspace + + + /etc/init.d/xvfb start +rc=$? +if [[ $rc != 0 ]] ; then + exit $rc +fi + + + install + (Default) + false + + + + + /etc/init.d/xvfb stop +rc=$? +if [[ $rc != 0 ]] ; then + exit $rc +fi + + + + + target/site/cobertura/coverage.xml + false + false + false + false + false + false + 0 + true + + + + + + + + + + UTF_8 + + + + + + DISPLAY=:99 + false + + + + \ No newline at end of file diff --git a/jenkins/jobs/GAU_self_cache/config.xml b/jenkins/jobs/GAU_self_cache/config.xml new file mode 100644 index 0000000..2525240 --- /dev/null +++ b/jenkins/jobs/GAU_self_cache/config.xml @@ -0,0 +1,106 @@ + + + + + false + + + 2 + + + origin + + file:///home/git/gau.git + + + + + self_cache + + + false + false + false + false + false + false + false + false + false + false + + Default + + + + + + + + false + + + + true + false + false + false + + + */10 * * * * + false + + + false + + + clean install + default + skipTests=true + false + + + + + + + + + contextRoot=gau +groupID=docstorage +artifactID=docstorage +version=1.3_SELF +type=war + + + Deploy + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/GIT Backups/config.xml b/jenkins/jobs/GIT Backups/config.xml new file mode 100644 index 0000000..4955bfc --- /dev/null +++ b/jenkins/jobs/GIT Backups/config.xml @@ -0,0 +1,46 @@ + + + + + + -1 + 10 + -1 + -1 + + false + + + true + false + false + false + + + H/30 * * * * + + + + false + + + /home/cfg/svn_backup/backup_dir_l1.sh /home/git /media/DATA/backups/git/ +#/home/cfg/svn_backup/backup_svn.sh /home/git /media/DATA/backups/git/ git + + + + + $DEFAULT_RECIPIENTS + default + $DEFAULT_SUBJECT + $DEFAULT_CONTENT + + $DEFAULT_PRESEND_SCRIPT + false + false + $DEFAULT_REPLYTO + false + + + + \ No newline at end of file diff --git a/jenkins/jobs/Gau_1.2/config.xml b/jenkins/jobs/Gau_1.2/config.xml new file mode 100644 index 0000000..04a6981 --- /dev/null +++ b/jenkins/jobs/Gau_1.2/config.xml @@ -0,0 +1,67 @@ + + + + + false + + + 2 + + + origin + + file:///home/git/gau.git + + + + + master + + + false + false + false + false + false + false + false + false + false + false + + Default + + + + + + + + false + + + + true + false + false + false + + + */10 * * * * + false + + + false + + + clean install + default + skipTests=true + false + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/Gau_1.3/config.xml b/jenkins/jobs/Gau_1.3/config.xml new file mode 100644 index 0000000..43b651f --- /dev/null +++ b/jenkins/jobs/Gau_1.3/config.xml @@ -0,0 +1,67 @@ + + + + + false + + + 2 + + + origin + + file:///home/git/gau.git + + + + + gau-1.3 + + + false + false + false + false + false + false + false + false + false + false + + Default + + + + + + + + false + + + + true + false + false + false + + + */10 * * * * + false + + + false + + + clean install + default + skipTests=true + false + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/LetsEncrypt renewal/config.xml b/jenkins/jobs/LetsEncrypt renewal/config.xml new file mode 100644 index 0000000..0e29af1 --- /dev/null +++ b/jenkins/jobs/LetsEncrypt renewal/config.xml @@ -0,0 +1,25 @@ + + + + + false + + + true + false + false + false + + false + + + service apache2 stop; + +/home/rudolf/tmp/letsencrypt/letsencrypt-auto certonly --standalone + +service apache2 start; + + + + + \ No newline at end of file diff --git a/jenkins/jobs/Monitoring/config.xml b/jenkins/jobs/Monitoring/config.xml new file mode 100644 index 0000000..717c765 --- /dev/null +++ b/jenkins/jobs/Monitoring/config.xml @@ -0,0 +1,118 @@ + + + + + + -1 + 15 + -1 + -1 + + false + + + + + git_revision + + ffbad2e7-29e6-44a3-8671-b4eba0a343d4 + PT_BRANCH + + + + + skipTests + + true + + + isDeploy + + false + + + + + + 2 + + + origin + file:///home/git/app_monitor.git + + + + + ${git_revision} + + + false + + + + + + true + false + false + false + + false + + + clean +install + default + false + + + + + + ${isDeploy} + + + + + + + contextRoot=monitoring +groupID=ua/rudolf/monitor +artifactID=server +version=1.0 +type=war + + + Deploy_tomcat + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/MySQL Backups/config.xml b/jenkins/jobs/MySQL Backups/config.xml new file mode 100644 index 0000000..16fc8c2 --- /dev/null +++ b/jenkins/jobs/MySQL Backups/config.xml @@ -0,0 +1,45 @@ + + + + + + -1 + 10 + -1 + -1 + + false + + + true + false + false + false + + + 0 3 * * * + + + + false + + + /home/cfg/svn_backup/backup_dir.sh /var/lib/mysql /media/DATA/backups/mysql/ mysql + + + + + $DEFAULT_RECIPIENTS + default + $DEFAULT_SUBJECT + $DEFAULT_CONTENT + + $DEFAULT_PRESEND_SCRIPT + false + false + $DEFAULT_REPLYTO + false + + + + \ No newline at end of file diff --git a/jenkins/jobs/SVN backups/config.xml b/jenkins/jobs/SVN backups/config.xml new file mode 100644 index 0000000..74a9de9 --- /dev/null +++ b/jenkins/jobs/SVN backups/config.xml @@ -0,0 +1,31 @@ + + + + + + -1 + 10 + -1 + -1 + + false + + + true + false + false + false + + + H/30 * * * * + + + false + + + /home/cfg/svn_backup/backup_dir.sh /home/svn/svn /media/DATA/backups/svn/ svn + + + + + \ No newline at end of file diff --git a/jenkins/jobs/smarthome/config.xml b/jenkins/jobs/smarthome/config.xml new file mode 100644 index 0000000..1dc21c2 --- /dev/null +++ b/jenkins/jobs/smarthome/config.xml @@ -0,0 +1,127 @@ + + + + + false + + + + -1 + 15 + -1 + -1 + + + + + + git_revision + + 2beb1658-77d1-44da-b592-0bd49ef05ba0 + PT_BRANCH_TAG + + * + NONE + + + + skipTests + + true + + + isDeploy + + false + + + + + + 2 + + + origin + git@rudolf.com.ua:avr.git + 057bac74-b42d-46d3-9c6f-bb1c81491d93 + + + + + ${git_revision} + + + false + + + + + + + true + false + false + false + + false + + + clean +install + maven 3.3.9 + web_ui/pom.xml + false + + + + + + ${isDeploy} + + + + + + + + contextRoot=smarthome +groupID=ua/rudolf/smarthome +artifactID=web-ui +version=1.0 +type=war + + + + Deploy_tomcat + ALWAYS + false + + + FAILURE + 2 + RED + true + + + UNSTABLE + 1 + YELLOW + true + + + FAILURE + 2 + RED + true + + + false + + + + + + + + + \ No newline at end of file diff --git a/jenkins/jobs/smarthome_master/config.xml b/jenkins/jobs/smarthome_master/config.xml new file mode 100644 index 0000000..9cf9cd8 --- /dev/null +++ b/jenkins/jobs/smarthome_master/config.xml @@ -0,0 +1,55 @@ + + + + + false + + + 2 + + + git@rudolf.com.ua:avr.git + 057bac74-b42d-46d3-9c6f-bb1c81491d93 + + + + + */master + + + false + + + + true + false + false + false + + + H/5 * * * * + false + + + false + + + + + + + git_revision=origin/master +isDeploy=true + + + smarthome + ALWAYS + false + false + + + + + + + \ No newline at end of file diff --git a/scratches/apache2.conf b/scratches/apache2.conf new file mode 100644 index 0000000..7f29aed --- /dev/null +++ b/scratches/apache2.conf @@ -0,0 +1,277 @@ +#ServerRoot "/etc/apache2" + +LockFile ${APACHE_LOCK_DIR}/accept.lock +PidFile ${APACHE_PID_FILE} +Timeout 300 +KeepAlive On +MaxKeepAliveRequests 100 +KeepAliveTimeout 5 + + + StartServers 5 + MinSpareServers 5 + MaxSpareServers 10 + MaxClients 150 + MaxRequestsPerChild 0 + + + + StartServers 2 + MinSpareThreads 25 + MaxSpareThreads 75 + ThreadLimit 64 + ThreadsPerChild 25 + MaxClients 150 + MaxRequestsPerChild 0 + + + + StartServers 2 + MinSpareThreads 25 + MaxSpareThreads 75 + ThreadLimit 64 + ThreadsPerChild 25 + MaxClients 150 + MaxRequestsPerChild 0 + + +# These need to be set in /etc/apache2/envvars +User ${APACHE_RUN_USER} +Group ${APACHE_RUN_GROUP} + +AccessFileName .htaccess + + + Order allow,deny + Deny from all + Satisfy all + + +DefaultType None + + + +HostnameLookups Off + +ErrorLog ${APACHE_LOG_DIR}/error.log + +LogLevel warn + +# Include module configuration: +Include mods-enabled/*.load +Include mods-enabled/*.conf + +ServerName rudolf.com.ua + + + SSLOptions +StdEnvVars + + + + SSLOptions +StdEnvVars + + +BrowserMatch "MSIE [2-6]" \ +nokeepalive ssl-unclean-shutdown \ +downgrade-1.0 force-response-1.0 + +# MSIE 7 and newer should be able to use keepalive +BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + +# Include ports listing +Include ports.conf + +LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined +LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %O" common +LogFormat "%{Referer}i -> %U" referer +LogFormat "%{User-agent}i" agent + + +Include conf.d/ + +Include macro.conf + + + + ServerAdmin rudolfss13@gmail.com + ServerName *.rudolf.com.ua + + Redirect 404 / + ErrorDocument 404 "Page Not Found" + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/rudolf.com.ua/chain.pem + + + + ServerAdmin rudolfss13@gmail.com + ServerName *.rudolf.com.ua + + RewriteEngine On + RewriteCond %{HTTPS} off + RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} + + + + +## Virtual hosts +Use DocRootVHost "rudolf" "/home/www/root" +Use DocRootVHost "static.rudolf" "/home/www/static" +Use ProxySSLVHost "torrent.rudolf" "/transmission" "http://localhost:9091/transmission" "torrent.rudolf" +Use ProxySSLVHost "syncthing.rudolf" "/" "http://localhost:8384/" "syncthing.rudolf" +Use ProxySSLVHost "jenkins.rudolf" "/" "http://localhost:8081/" "jenkins.rudolf" +# TODO Header edit Location ^http://jenkins.rudolf.com.ua https://jenkins.rudolf.com.ua +Use ProxySSLVHost "webmin.rudolf" "/" "http://localhost:10000/" "webmin.rudolf" +Use ProxySSLVHost "bitsync.rudolf" "/" "http://localhost:8888/" "bitsync.rudolf" + + + + ServerAdmin rudolfss13@gmail.com + ServerName wa.rudolf.com.ua + + ProxyPass / https://web.whatsapp.com/ + ProxyPassReverse / https://web.whatsapp.com/ + + # ProxyPass wss://w1.wa.rudolf.com.ua/ws wss://w1.web.whatsapp.com/ws + # #ProxyPassReverse wss://w1.wa.rudolf.com.ua/ws wss://w1.web.whatsapp.com/ws + # ProxyPass wss://w2.wa.rudolf.com.ua/ws wss://w2.web.whatsapp.com/ws + # #ProxyPassReverse wss://w2.wa.rudolf.com.ua/ws wss://w2.web.whatsapp.com/ws + # ProxyPass wss://w3.wa.rudolf.com.ua/ws wss://w3.web.whatsapp.com/ws + # #ProxyPassReverse wss://w3.wa.rudolf.com.ua/ws wss://w3.web.whatsapp.com/ws + # ProxyPass wss://w4.wa.rudolf.com.ua/ws wss://w4.web.whatsapp.com/ws + # #ProxyPassReverse wss://w4.wa.rudolf.com.ua/ws wss://w4.web.whatsapp.com/ws + # ProxyPass wss://w5.wa.rudolf.com.ua/ws wss://w5.web.whatsapp.com/ws + # #ProxyPassReverse wss://w5.wa.rudolf.com.ua/ws wss://w5.web.whatsapp.com/ws + # ProxyPass wss://w6.wa.rudolf.com.ua/ws wss://w6.web.whatsapp.com/ws + # #ProxyPassReverse wss://w6.wa.rudolf.com.ua/ws wss://w6.web.whatsapp.com/ws + # ProxyPass wss://w7.wa.rudolf.com.ua/ws wss://w7.web.whatsapp.com/ws + # #ProxyPassReverse wss://w7.wa.rudolf.com.ua/ws wss://w7.web.whatsapp.com/ws + # ProxyPass wss://w8.wa.rudolf.com.ua/ws wss://w8.web.whatsapp.com/ws + # #ProxyPassReverse wss://w8.wa.rudolf.com.ua/ws wss://w8.web.whatsapp.com/ws + + SSLProxyEngine on + + SetOutputFilter INFLATE;SUBSTITUTE + + Substitute "s|web.whatsapp.com|wa.rudolf.com.ua|ni" + + Header edit* Content-Security-Policy web.whatsapp.com wa.rudolf.com.ua + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/wa.rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/wa.rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/wa.rudolf.com.ua/chain.pem + + + + + +# TODO smarthome.rudolf.com.ua + + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/chain.pem + + Use GoogleAuth https://smarthome.rudolf.com.ua/oauth2callback / + + + Require claim email:rudolfss13@gmail.com + Require claim email:malta4ka@gmail.com + + +# ProxyPass / http://192.168.17.2:8080/smarthome/ +# ProxyPassReverse / http://192.168.17.2:8080/smarthome/ + + ProxyPass / http://192.168.17.3:8080/smarthome/ + ProxyPassReverse / http://192.168.17.3:8080/smarthome/ + + + + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + + Order deny,allow + Deny from all + Allow from 192.168.17. + Allow from 5.19.137.112 + + + + SSLEngine off + +# ProxyPass / http://192.168.17.2:8080/smarthome/ +# ProxyPassReverse / http://192.168.17.2:8080/smarthome/ + + ProxyPass / http://192.168.17.3:8080/smarthome/ + ProxyPassReverse / http://192.168.17.3:8080/smarthome/ + + + + + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/smarthome.rudolf.com.ua/chain.pem + + + + AuthType None + Require all granted + + + + Use GoogleAuth https://smarthome.rudolf.com.ua:444/oauth2callback / + + +# +# Require claim email:rudolfss13@gmail.com +# Require claim email:malta4ka@gmail.com +# + + + ProxyPass / http://192.168.17.106:9999/ + ProxyPassReverse / http://192.168.17.106:9999/ + + + + + +# ./letsencrypt-auto renew --standalone +# ./letsencrypt-auto certonly --standalone -d rudolf.com.ua + + +# rudolf.com.ua +# jenkins.rudolf.com.ua +# torrent.rudolf.com.ua +# syncthing.rudolf.com.ua +# dev.rudolf.com.ua +# ejudge.rudolf.com.ua +# webmin.rudolf.com.ua +# smarthome.rudolf.com.ua +# bitsync.rudolf.com.ua +# wa.rudolf.com.ua +# static.rudolf.com.ua + + +#Include sites-enabled/ diff --git a/scratches/apache2.hosts b/scratches/apache2.hosts new file mode 100644 index 0000000..dd5f3a9 --- /dev/null +++ b/scratches/apache2.hosts @@ -0,0 +1,54 @@ + + +Use DocRootVHost "static.rudolf" "/home/www/static" +Use ProxySSLVHost "torrent.rudolf" "/transmission" "http://localhost:9091/transmission" "torrent.rudolf" +Use ProxySSLVHost "syncthing.rudolf" "/" "http://localhost:8384/" "syncthing.rudolf" +Use ProxySSLVHost "jenkins.rudolf" "/" "http://localhost:8081/" "jenkins.rudolf" +# TODO Header edit Location ^http://jenkins.rudolf.com.ua https://jenkins.rudolf.com.ua +Use ProxySSLVHost "webmin.rudolf" "/" "http://localhost:10000/" "webmin.rudolf" +Use ProxySSLVHost "bitsync.rudolf" "/" "http://localhost:8888/" "bitsync.rudolf" + + + + ServerAdmin rudolfss13@gmail.com + ServerName wa.rudolf.com.ua + + ProxyPass / https://web.whatsapp.com/ + ProxyPassReverse / https://web.whatsapp.com/ + + # ProxyPass wss://w1.wa.rudolf.com.ua/ws wss://w1.web.whatsapp.com/ws + # #ProxyPassReverse wss://w1.wa.rudolf.com.ua/ws wss://w1.web.whatsapp.com/ws + # ProxyPass wss://w2.wa.rudolf.com.ua/ws wss://w2.web.whatsapp.com/ws + # #ProxyPassReverse wss://w2.wa.rudolf.com.ua/ws wss://w2.web.whatsapp.com/ws + # ProxyPass wss://w3.wa.rudolf.com.ua/ws wss://w3.web.whatsapp.com/ws + # #ProxyPassReverse wss://w3.wa.rudolf.com.ua/ws wss://w3.web.whatsapp.com/ws + # ProxyPass wss://w4.wa.rudolf.com.ua/ws wss://w4.web.whatsapp.com/ws + # #ProxyPassReverse wss://w4.wa.rudolf.com.ua/ws wss://w4.web.whatsapp.com/ws + # ProxyPass wss://w5.wa.rudolf.com.ua/ws wss://w5.web.whatsapp.com/ws + # #ProxyPassReverse wss://w5.wa.rudolf.com.ua/ws wss://w5.web.whatsapp.com/ws + # ProxyPass wss://w6.wa.rudolf.com.ua/ws wss://w6.web.whatsapp.com/ws + # #ProxyPassReverse wss://w6.wa.rudolf.com.ua/ws wss://w6.web.whatsapp.com/ws + # ProxyPass wss://w7.wa.rudolf.com.ua/ws wss://w7.web.whatsapp.com/ws + # #ProxyPassReverse wss://w7.wa.rudolf.com.ua/ws wss://w7.web.whatsapp.com/ws + # ProxyPass wss://w8.wa.rudolf.com.ua/ws wss://w8.web.whatsapp.com/ws + # #ProxyPassReverse wss://w8.wa.rudolf.com.ua/ws wss://w8.web.whatsapp.com/ws + + SSLProxyEngine on + + SetOutputFilter INFLATE;SUBSTITUTE + + Substitute "s|web.whatsapp.com|wa.rudolf.com.ua|ni" + + Header edit* Content-Security-Policy web.whatsapp.com wa.rudolf.com.ua + + SSLEngine on + + SSLCertificateFile /etc/letsencrypt/live/wa.rudolf.com.ua/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/wa.rudolf.com.ua/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/wa.rudolf.com.ua/chain.pem + + + + + + diff --git a/scratches/jenkins_plugins b/scratches/jenkins_plugins new file mode 100644 index 0000000..5e420da --- /dev/null +++ b/scratches/jenkins_plugins @@ -0,0 +1,52 @@ +analysis-core +ant +antisamy-markup-formatter +build-env-propagator +build-pipeline-plugin +cobertura +conditional-buildstep +credentials+ +cvs +dependencyanalyzer +deploy +display-url-api+ +email-ext +envinject +external-monitor-job +gcal +git+ +git-client+ +git-parameter +javadoc +jquery +jshint-checkstyle +jslint-checkstyle +junit+ +junit-realtime-test-reporter +ldap +m2release +mailer+ +mapdb-api +matrix-auth +matrix-project+ +maven-metadata-plugin +maven-plugin +pam-auth +parameterized-trigger +performance +run-condition +scm-api+ +script-security+ +seleniumhtmlreport +ssh-agent +ssh-credentials+ +ssh-slaves +structs+ +subversion +testInProgress +token-macro +translation +windows-slaves +workflow-scm-step+ +workflow-step-api+ +xunit \ No newline at end of file diff --git a/scratches/pi_default b/scratches/pi_default new file mode 100644 index 0000000..72da125 --- /dev/null +++ b/scratches/pi_default @@ -0,0 +1,43 @@ + + + ServerAdmin rudolfss13@gmail.com + ServerName smarthome.rudolf.com.ua + + + Order deny,allow + Deny from all + Allow from 192.168.17. + Allow from 5.19.137.112 + + + +# SSLEngine off + +# ProxyPass / http://192.168.17.2:8080/smarthome/ +# ProxyPassReverse / http://192.168.17.2:8080/smarthome/ + + ProxyPass / http://192.168.17.3:8080/smarthome/ + ProxyPassReverse / http://192.168.17.3:8080/smarthome/ + + + + + ServerAdmin rudolfss13@gmail.com + ServerName rudolf.com.ua + + + Order deny,allow + Deny from all + Allow from 192.168.17. + Allow from 5.19.137.112 + + + +# SSLEngine off + + ProxyPass / http://192.168.17.2/ + ProxyPassReverse / http://192.168.17.2/ + +# ProxyPass / http://192.168.17.3:8080/smarthome/ +# ProxyPassReverse / http://192.168.17.3:8080/smarthome/ + diff --git a/scratches/ports.conf b/scratches/ports.conf new file mode 100644 index 0000000..19afe29 --- /dev/null +++ b/scratches/ports.conf @@ -0,0 +1,28 @@ +# If you just change the port or add more ports here, you will likely also +# have to change the VirtualHost statement in +# /etc/apache2/sites-enabled/000-default +# This is also true if you have upgraded from before 2.2.9-3 (i.e. from +# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and +# README.Debian.gz + +NameVirtualHost *:80 +Listen 80 + + + # If you add NameVirtualHost *:443 here, you will also have to change + # the VirtualHost statement in /etc/apache2/sites-available/default-ssl + # to + # Server Name Indication for SSL named virtual hosts is currently not + # supported by MSIE on Windows XP. + NameVirtualHost *:443 + NameVirtualHost *:444 + Listen 443 + Listen 444 + + + + + Listen 443 + Listen 444 + + diff --git a/scratches/tomcat-users.xml b/scratches/tomcat-users.xml new file mode 100644 index 0000000..41e196b --- /dev/null +++ b/scratches/tomcat-users.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/site.yml b/site.yml deleted file mode 100644 index d592909..0000000 --- a/site.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- - -- hosts: apache - become: yes - - vars: - http_port: 80 - https_port: 443 - domain: rudolf.com.ua - - tasks: - - - name: install apache2 - apt: name=apache2 update_cache=yes state=latest - - - name: apache2 listen on port {{ http_port }} and {{ https_port }} - lineinfile: - dest: /etc/apache2/ports.conf - regexp: "{{ item.regexp }}" - line: "{{ item.line }}" - state: present - with_items: - - { regexp: "^.*Listen {{ http_port }}", line: "Listen {{ http_port }}" } - - { regexp: "^.*Listen {{ https_port }}", line: "Listen {{ https_port }}" } - - notify: - - restart apache2 - - - - name: enabled mod_proxy_http - apache2_module: name=proxy_http state=present - notify: - - restart apache2 - - handlers: - - name: restart apache2 - service: name=apache2 state=restarted diff --git a/syncthing.yaml b/syncthing.yaml index a5b1ef4..3515c7c 100644 --- a/syncthing.yaml +++ b/syncthing.yaml @@ -22,7 +22,7 @@ - name: create service file copy: - src: syncthing.service + src: syncthing/syncthing.service dest: /etc/systemd/system/syncthing.service mode: 755 register: systemd_conf @@ -35,7 +35,7 @@ - name: create config file copy: - src: config.xml + src: syncthing/config.xml dest: ~/.config/syncthing/config.xml become_user: "{{ user }}" diff --git a/config.xml b/syncthing/config.xml similarity index 100% rename from config.xml rename to syncthing/config.xml diff --git a/syncthing.service b/syncthing/syncthing.service similarity index 100% rename from syncthing.service rename to syncthing/syncthing.service diff --git a/tomcat.yaml b/tomcat.yaml new file mode 100644 index 0000000..31a17fe --- /dev/null +++ b/tomcat.yaml @@ -0,0 +1,32 @@ +--- +- hosts: serva4og + vars: + user: rudolf + become: yes + + tasks: + + - name: install packages + apt: name={{ item }} update_cache=yes state=latest + with_items: + - docker.io + - python-docker + + - name: user {{ user }} + user: + name: "{{ user }}" + groups: docker + append: yes + + - name: run tomcat docker + docker: + name: tomcat + image: tomcat:jre8 + detach: True + net: default + ports: + - "0.0.0.0:{{ tomcat_port }}:8080" + volumes: + - "/var/tomcat:/usr/local/tomcat/webapps" + + state: reloaded