Skip to content

Commit

Permalink
Merge pull request #2 from t-koike/problem2
Browse files Browse the repository at this point in the history
Problem2 の docker-compose.yml とその他の設定ファイルを追加
  • Loading branch information
t-koike authored Jan 21, 2022
2 parents 5d293cd + c7a00e5 commit f7dc406
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 0 deletions.
53 changes: 53 additions & 0 deletions problem2/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: "3"

networks:
front:
ipam:
config:
- subnet: 10.0.0.0/16
back:
ipam:
config:
- subnet: 10.10.0.0/16

volumes:
socket:
driver: local
log:
driver: local
docroot:
driver: local

services:
reverse_proxy:
image: nginx:latest
container_name: reverse_proxy
networks:
- front
ports:
- "8080:80"
volumes:
- ./docroot:/usr/share/nginx/html
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
# app:
# build: ../problem1/app/
# container_name: minimal_sns_app
# volumes:
# - socket:/var/run/unicorn/
# networks:
# - front
# environment:
# - "TZ=Asia/Tokyo"
db:
image: mysql:latest
container_name: db
networks:
- back
volumes:
- ./mysql/my.cnf:/etc/mysql/my.cnf
- ./mysql/conf.d/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
- ./mysql/0_init.sql:/docker-entrypoint-initdb.d/0_init.sql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: app
5 changes: 5 additions & 0 deletions problem2/docroot/file/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
404 Page
</body>
</html>
5 changes: 5 additions & 0 deletions problem2/docroot/file/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
Error Page
</body>
</html>
5 changes: 5 additions & 0 deletions problem2/docroot/file/maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
Maintenance Page
</body>
</html>
Binary file added problem2/docroot/img/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added problem2/docroot/img/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions problem2/docroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
Top Page
</body>
</html>
20 changes: 20 additions & 0 deletions problem2/mysql/0_init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE `users` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`name` varchar(64) DEFAULT '' NOT NULL,
PRIMARY KEY (`id`)
);
-- user1 user2
CREATE TABLE `friend_link` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user1_id` int(11) NOT NULL,
`user2_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
-- user1 user2 block
CREATE TABLE `block_list` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user1_id` int(11) NOT NULL,
`user2_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
29 changes: 29 additions & 0 deletions problem2/mysql/conf.d/mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2015, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysql]
29 changes: 29 additions & 0 deletions problem2/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL

# Custom config should go here
!includedir /etc/mysql/conf.d/
8 changes: 8 additions & 0 deletions problem2/nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

# FIXME
}

31 changes: 31 additions & 0 deletions problem2/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
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;

include /etc/nginx/conf.d/*.conf;
}

0 comments on commit f7dc406

Please sign in to comment.