Skip to content

Commit 6160b20

Browse files
committed
ctor: add initial host specification
1 parent 7f6680f commit 6160b20

10 files changed

Lines changed: 266 additions & 0 deletions

File tree

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true

Readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ We're hosting a set of services:
1313
If you have an issue with any of these services, feel free to [open an
1414
issue][issues].
1515

16+
Host specification
17+
------------------
18+
19+
- [codingteam.org.ru][host-ctor]
20+
21+
[host-ctor]: ctos/Host.md
22+
1623
[codingteam.org.ru]: https://codingteam.org.ru
1724
[issues]: https://github.com/codingteam/devops/issues
1825
[loglist.net]: https://loglist.net

ctor/Host.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
codingteam.org.ru
2+
-----------------
3+
4+
This is a service hosted on Digital Ocean.
5+
6+
Enabled end-user services:
7+
8+
- [codingteam.org.ru][]
9+
- [loglist][]
10+
- [svg-cgs][]
11+
12+
Make sure to set up `/etc/loglist/loglist.conf` (see
13+
[`loglist.sample.conf`][loglist-sample-conf]).
14+
15+
Enabled infrastructural services:
16+
17+
- nginx
18+
- PostgreSQL
19+
20+
[loglist-sample-conf]: etc/loglist/loglist.conf
21+
22+
[codingteam.org.ru]: https://github.com/codingteam/codingteam.org.ru
23+
[loglist]: https://github.com/codingteam/loglist
24+
[svg-cgs]: https://github.com/codingteam/svg-cgs
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
APPLY_EVOLUTIONS_SILENTLY=true
2+
APPROVAL_EMAIL=loglist@example.com
3+
APPROVAL_EMAIL_PASSWORD=example-mail-password
4+
APPROVAL_SMTP_HOST=smtp.example.com
5+
BASIC_AUTH_PASSWORD=basic-password
6+
BASIC_AUTH_USERNAME=example-user
7+
DATABASE_URL=jdbc:postgresql:loglist?user=username&password=postgresql-password
8+
JAVA_OPTS=-Xmx384m -Xss512k -XX:+UseCompressedOops
9+
RECAPTCHA_PRIVATE_KEY=recaptcha-private-key
10+
RECAPTCHA_PUBLIC_KEY=recaptcha-public-key

ctor/etc/nginx/nginx.conf

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
user www-data;
2+
worker_processes 4;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 768;
7+
# multi_accept on;
8+
}
9+
10+
http {
11+
12+
##
13+
# Basic Settings
14+
##
15+
16+
sendfile on;
17+
tcp_nopush on;
18+
tcp_nodelay on;
19+
keepalive_timeout 65;
20+
types_hash_max_size 2048;
21+
# server_tokens off;
22+
23+
server_names_hash_bucket_size 64;
24+
# server_name_in_redirect off;
25+
26+
include /etc/nginx/mime.types;
27+
default_type application/octet-stream;
28+
29+
##
30+
# Logging Settings
31+
##
32+
33+
access_log /var/log/nginx/access.log;
34+
error_log /var/log/nginx/error.log;
35+
36+
##
37+
# Gzip Settings
38+
##
39+
40+
gzip on;
41+
gzip_disable "msie6";
42+
43+
# gzip_vary on;
44+
# gzip_proxied any;
45+
# gzip_comp_level 6;
46+
# gzip_buffers 16 8k;
47+
# gzip_http_version 1.1;
48+
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
49+
50+
##
51+
# nginx-naxsi config
52+
##
53+
# Uncomment it if you installed nginx-naxsi
54+
##
55+
56+
#include /etc/nginx/naxsi_core.rules;
57+
58+
##
59+
# nginx-passenger config
60+
##
61+
# Uncomment it if you installed nginx-passenger
62+
##
63+
64+
#passenger_root /usr;
65+
#passenger_ruby /usr/bin/ruby;
66+
67+
##
68+
# Virtual Host Configs
69+
##
70+
71+
include /etc/nginx/conf.d/*.conf;
72+
include /etc/nginx/sites-enabled/*;
73+
}
74+
75+
76+
#mail {
77+
# # See sample authentication script at:
78+
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
79+
#
80+
# # auth_http localhost/auth.php;
81+
# # pop3_capabilities "TOP" "USER";
82+
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
83+
#
84+
# server {
85+
# listen localhost:110;
86+
# protocol pop3;
87+
# proxy on;
88+
# }
89+
#
90+
# server {
91+
# listen localhost:143;
92+
# protocol imap;
93+
# proxy on;
94+
# }
95+
#}

ctor/etc/nginx/sites-available/cad

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name cad.codingteam.org.ru;
5+
6+
root /opt/svg-cgs;
7+
index index.html index.htm;
8+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
server {
2+
listen 443 ssl;
3+
server_name codingteam.org.ru;
4+
keepalive_timeout 60;
5+
ssl_certificate /etc/letsencrypt/live/loglist.net/fullchain.pem;
6+
ssl_certificate_key /etc/letsencrypt/live/loglist.net/privkey.pem;
7+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
8+
ssl_ciphers "HIGH:!aNULL:!MD5:!kEDH";
9+
add_header Strict-Transport-Security 'max-age=15552000';
10+
11+
location /_logs/ {
12+
proxy_set_header X-Forwarded-Host $host;
13+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14+
proxy_set_header X-Forwarded-Proto $scheme;
15+
proxy_http_version 1.1;
16+
proxy_pass http://0xd34df00d.me/logs/chat/;
17+
}
18+
19+
20+
location / {
21+
proxy_set_header X-Forwarded-Host $host;
22+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23+
proxy_set_header X-Forwarded-Proto $scheme;
24+
proxy_set_header Host codingteam.org.ru;
25+
proxy_http_version 1.1;
26+
proxy_pass http://localhost:5000/;
27+
}
28+
}
29+
30+
server {
31+
listen 80;
32+
server_name codingteam.org.ru;
33+
34+
location / {
35+
rewrite ^(.*)$ https://codingteam.org.ru$1 permanent;
36+
}
37+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# You may add here your
2+
# server {
3+
# ...
4+
# }
5+
# statements for each of your virtual hosts to this file
6+
7+
##
8+
# You should look at the following URL's in order to grasp a solid understanding
9+
# of Nginx configuration files in order to fully unleash the power of Nginx.
10+
# http://wiki.nginx.org/Pitfalls
11+
# http://wiki.nginx.org/QuickStart
12+
# http://wiki.nginx.org/Configuration
13+
#
14+
# Generally, you will want to move this file somewhere, and start with a clean
15+
# file but keep this around for reference. Or just disable in sites-enabled.
16+
#
17+
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
18+
##
19+
20+
server {
21+
listen 443 ssl;
22+
server_name loglist.net;
23+
keepalive_timeout 60;
24+
ssl_certificate /etc/letsencrypt/live/loglist.net/fullchain.pem;
25+
ssl_certificate_key /etc/letsencrypt/live/loglist.net/privkey.pem;
26+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
27+
ssl_ciphers "HIGH:!aNULL:!MD5:!kEDH";
28+
add_header Strict-Transport-Security 'max-age=15552000';
29+
30+
location / {
31+
proxy_set_header X-Forwarded-Host $host;
32+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
33+
proxy_set_header X-Forwarded-Proto $scheme;
34+
proxy_set_header Host loglist.net;
35+
proxy_http_version 1.1;
36+
proxy_pass http://localhost:9000/;
37+
}
38+
}
39+
40+
41+
server {
42+
listen 80;
43+
server_name loglist.net;
44+
45+
location / {
46+
rewrite ^(.*)$ https://loglist.net$1 permanent;
47+
}
48+
}
49+
50+
server {
51+
listen 80;
52+
server_name *.loglist.net;
53+
location / {
54+
return 301 https://loglist.net$request_uri;
55+
}
56+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Unit]
2+
Description=codingteam.org.ru site
3+
After=network.target
4+
5+
[Service]
6+
User=cor-site
7+
WorkingDirectory=/opt/codingteam/codingteam.org.ru/
8+
ExecStart=/usr/bin/dotnet /opt/codingteam/codingteam.org.ru/codingteam.org.ru.dll
9+
10+
[Install]
11+
WantedBy=multi-user.target
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Unit]
2+
Description=loglist.net site
3+
After=network.target
4+
5+
[Service]
6+
EnvironmentFile=/etc/loglist/loglist.conf
7+
ExecStart=/opt/loglist/bin/loglist-jvm -Dhttp.port=9000 -Dhttp.address=127.0.0.1
8+
9+
[Install]
10+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)