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

Experimental:配布用zipの生成スクリプトとそのサンプル #127

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/dump_data.sql
/dump_all.sql
/dump_schema.sql
/fc2blog-dist*.zip
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,26 @@ db-dump-all:
.PHONY: db-dump-data-only
db-dump-data-only:
mysqldump -u docker -pdocker -h 127.0.0.1 -P 3306 --complete-insert --skip-extended-insert --column-statistics=0 --skip-triggers --no-create-db --no-create-info "dev_fc2blog" | sed "s/ AUTO_INCREMENT=[0-9]*//" > dump_data.sql

.PHONY: build-dist-zip
build-dist-zip:
find app public |grep .DS_Store |xargs rm
$(eval date := $(shell date "+%Y%m%d%H%M%S")-$(shell git rev-parse --short HEAD))
$(eval tmpdir := fc2blog-dist-$(date))
mkdir $(tmpdir)
composer install --no-dev --optimize-autoloader
cp -a app $(tmpdir)
cp LICENSE.txt $(tmpdir)/app
rm -r $(tmpdir)/app/temp/*
chmod 777 $(tmpdir)/app/temp/
cp -a public $(tmpdir)
rm -r $(tmpdir)/public/uploads/*
chmod 777 $(tmpdir)/public/uploads/
rm -r $(tmpdir)/public/_for_unit_test_
rm -r $(tmpdir)/public/.htaccess
cp -r app/docs/apache/.htaccess.production $(tmpdir)/public/.htaccess
cp LICENSE.txt README.md $(tmpdir)/app
zip -r $(tmpdir).zip $(tmpdir)
rm -r $(tmpdir)
composer install
echo "build $(tmpdir).zip successfully"
49 changes: 49 additions & 0 deletions app/docs/DEPLOY_ubuntu20.04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Ubuntu 20.04 最短構築

## 初期Linux設定
```
$ sudo su
# apt -y update && apt -y upgrade && shutdown -r now

$ sudo su
# ufw allow 22
# ufw allow 80
# ufw allow 443
# ufw enable
# ufw status
# timedatectl set-timezone Asia/Tokyo
# apt -y install apache2 php-mysql php-mbstring php-gd php-curl php-intl php-zip mysql-server php7.4 unzip
# apt -y install language-pack-ja-base language-pack-ja
# locale -a
(ja_JP.UTF-8の確認)
```

## mysql
```
$ sudo mysql_secure_installation
$ sudo mysql -u root
> create user 'fc2blog'@'localhost' identified by 'topsecretpasswordforyoursafe';
> grant all on fc2blog.* to 'fc2blog'@'localhost' with grant option;
> flush privileges;
> exit
```

## deploy
```
$ cd
$ wget http://github.com/..../fc2blog-dist-XXX.zip (例
$ unzip fc2blog-dist-XXX.zip
$ sudo su
# cp -a fc2blog-dist-XXX/* /var/www
# cp fc2blog-dist-XXX/app/resource/apache/100-fc2blog.conf /etc/apache2/sites-available/
# vi /etc/apache2/sites-available/100-fc2blog.conf
# a2dissite 000-default.conf
# a2ensite 100-fc2blog.conf
# a2enmod rewrite
# systemctl restart apache2

# cp /var/www/app/config.sample.php /var/www/app/config.php
# vi /var/www/app/config.php
```

`http://{ホスト}/install.php` を開く
18 changes: 18 additions & 0 deletions app/docs/apache/.htaccess.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## ログ設定
### エラーを画面に表示する、可能ならば本番時はコメントアウト推奨
#php_value display_errors on
#php_value display_startup_errors On
#php_value error_reporting -1
### エラーをログする、本番時も有効化推奨
php_value log_errors On

## mod_rewirte 設定、通常修正不要
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]

RewriteRule . index.php [L]

14 changes: 14 additions & 0 deletions app/docs/apache/100-fc2blog.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/public>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>