Skip to content

Commit 6cefb26

Browse files
committed
bugfix for laravel 5.8 and create docker image
1 parent 3412a57 commit 6cefb26

18 files changed

+196
-45
lines changed

.dockerignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
wizard
2+
data.db
3+
/node_modules
4+
/public/hot
5+
/public/storage
6+
/storage/*.key
7+
/vendor
8+
/.idea
9+
/.vagrant
10+
Homestead.json
11+
Homestead.yaml
12+
.env
13+
/old2
14+
*.log
15+
_ide_*.php
16+
.git/
17+
.DS_Store
18+
.phpstorm.meta.php
19+
docker-compose/
20+
storage/api-docs/*
21+
storage/app/public/*
22+
storage/debugbar/*
23+
storage/framework/cache/data/*
24+
storage/framework/sessions/*
25+
storage/framework/views/*
26+
storage/logs/*
27+
bootstrap/cache/*

.env.docker

+32-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1+
# 应用名称
12
APP_NAME="Wizard Doc"
2-
APP_ENV=local
3+
# 环境,正式请使用 production
4+
APP_ENV=production
35
APP_KEY=base64:9ZqHD9ABVYkfN1il53mBYAqN/ZqEeSvUz3zPt2z3KFM=
4-
APP_DEBUG=true
5-
APP_LOG_LEVEL=debug
6+
# 调试和日志级别
7+
APP_DEBUG=false
8+
APP_LOG_LEVEL=info
9+
# 应用服务地址
610
APP_URL=http://localhost
711

12+
# 数据库连接配置
813
DB_CONNECTION=mysql
9-
DB_HOST=db
10-
DB_PORT=3306
11-
DB_DATABASE=wizard
12-
DB_USERNAME=root
13-
DB_PASSWORD=111111
14+
DB_HOST=
15+
DB_PORT=
16+
DB_DATABASE=
17+
DB_USERNAME=
18+
DB_PASSWORD=
1419

1520
BROADCAST_DRIVER=log
1621
CACHE_DRIVER=file
1722
SESSION_DRIVER=file
1823
QUEUE_DRIVER=sync
1924

25+
# Redis 连接配置
2026
REDIS_HOST=127.0.0.1
2127
REDIS_PASSWORD=null
2228
REDIS_PORT=6379
2329

30+
# 邮件服务器配置
2431
MAIL_DRIVER=smtp
2532
MAIL_HOST=smtp.mailtrap.io
2633
MAIL_PORT=2525
@@ -35,23 +42,36 @@ PUSHER_APP_SECRET=
3542

3643
APP_TIMEZONE=Asia/Shanghai
3744

38-
WIZARD_NEED_ACTIVATE=true
45+
# 用户帐号是否需要邮件激活
46+
WIZARD_NEED_ACTIVATE=false
47+
# 加密密钥
3948
WIZARD_JWT_SECRET=5Dck4izVEXsP52AOcVxaFUsTzA8uwUiP
49+
# 当前版本,目前的作用是刷新静态资源缓存
4050
WIZARD_RESOURCE_VERSION=201709071014
41-
APP_LOG=errorlog
42-
51+
# 是否启用 LDAP 登录
4352
WIZARD_USE_LDAP=false
4453

54+
# 是否开启 LDAP 日志
4555
LDAP_LOGGING=true
56+
# LDAP 帐号前缀/后缀
4657
LDAP_ACCOUNT_PREFIX=
4758
LDAP_ACCOUNT_SUFFIX=
59+
# LDAP 服务地址
4860
LDAP_HOSTS=
4961
LDAP_PORT=
62+
# LDAP Base DN
5063
LDAP_BASE_DN=
64+
# LDAP 授权帐号
5165
LDAP_USERNAME=
5266
LDAP_PASSWORD=
67+
# LDAP 连接安全配置
5368
LDAP_USE_SSL=false
5469
LDAP_USE_TLS=false
70+
# 同步 LDAP 密码到本地
5571
LDAP_PASSWORD_SYNC=true
72+
# 如果 LDAP 登录失败,是否使用本地帐号密码登录
5673
LDAP_LOGIN_FALLBACK=true
57-
LDAP_SYNC_NAME_ATTR=cn
74+
# LDAP 信息中,用哪个字段作为用户的名称,比如 displayname, cn 等
75+
LDAP_SYNC_NAME_ATTR=cn
76+
# LDAP 限制只允许属于该成员的用户登录
77+
WIZARD_LDAP_ONLY_MEMBER_OF=

Dockerfile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM php:7.3-apache
2+
3+
WORKDIR /webroot
4+
ENV APACHE_DOCUMENT_ROOT /webroot/public
5+
6+
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
7+
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
8+
9+
RUN echo "memory_limit=-1" > "$PHP_INI_DIR/conf.d/memory-limit.ini" \
10+
&& echo "date.timezone=${PHP_TIMEZONE:-UTC}" > "$PHP_INI_DIR/conf.d/date_timezone.ini"
11+
12+
RUN apt-get update && apt-get install -y \
13+
libfreetype6-dev \
14+
libjpeg62-turbo-dev \
15+
libmcrypt-dev \
16+
libpng-dev \
17+
libzip-dev \
18+
libldap-dev \
19+
wget \
20+
curl \
21+
git \
22+
subversion \
23+
zip \
24+
unzip \
25+
mercurial \
26+
--no-install-recommends && rm -r /var/lib/apt/lists/* \
27+
&& docker-php-ext-install -j$(nproc) pcntl exif pdo_mysql zip ldap \
28+
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
29+
&& docker-php-ext-install -j$(nproc) gd
30+
RUN wget https://getcomposer.org/download/1.6.4/composer.phar \
31+
&& mv composer.phar /usr/bin/composer.phar \
32+
&& chmod +x /usr/bin/composer.phar \
33+
&& ln -s /usr/bin/composer.phar /usr/bin/composer \
34+
&& php /usr/bin/composer config -g repo.packagist composer https://packagist.phpcomposer.com
35+
36+
RUN a2enmod rewrite
37+
38+
COPY ./composer.lock ./composer.json /webroot/
39+
RUN php /usr/bin/composer install --prefer-dist --no-autoloader --no-scripts --no-dev
40+
41+
COPY ./ /webroot
42+
43+
RUN cp .env.docker .env \
44+
&& php /usr/bin/composer dump-autoload --no-scripts --optimize \
45+
&& php /usr/bin/composer run-script post-install-cmd \
46+
&& chown www-data:www-data -R ./ \
47+
&& php artisan storage:link

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
build:
3+
docker build -t mylxsw/wizard .

config/app.php

-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@
176176
// App\Providers\BroadcastServiceProvider::class,
177177
App\Providers\EventServiceProvider::class,
178178
App\Providers\RouteServiceProvider::class,
179-
180-
\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
181-
\Barryvdh\Debugbar\ServiceProvider::class,
182179
],
183180

184181
/*

docker-compose.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
- backend
2222
php-fpm:
2323
build:
24-
context: ./docker/php-fpm
24+
context: ./docker-compose/php-fpm
2525
dockerfile: Dockerfile
2626
volumes:
2727
- app_volume:/data/
@@ -37,16 +37,16 @@ services:
3737
volumes:
3838
- app_volume:/data/www
3939
- .:/webroot/wizard
40-
- ./nginx.conf:/etc/nginx/conf.d/default.conf
40+
- ./docker-compose/nginx.conf:/etc/nginx/conf.d/default.conf
4141
ports:
42-
- "8888:80"
42+
- "8080:80"
4343
networks:
4444
- backend
4545
depends_on:
4646
- php-fpm
4747
php:
4848
build:
49-
context: ./docker/php
49+
context: ./docker-compose/php
5050
dockerfile: Dockerfile
5151
volumes:
5252
- app_volume:/data/

docker-compose/.env.docker

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
APP_NAME="Wizard Doc"
2+
APP_ENV=local
3+
APP_KEY=base64:9ZqHD9ABVYkfN1il53mBYAqN/ZqEeSvUz3zPt2z3KFM=
4+
APP_DEBUG=true
5+
APP_LOG_LEVEL=debug
6+
APP_URL=http://localhost
7+
8+
DB_CONNECTION=mysql
9+
DB_HOST=db
10+
DB_PORT=3306
11+
DB_DATABASE=wizard
12+
DB_USERNAME=root
13+
DB_PASSWORD=111111
14+
15+
BROADCAST_DRIVER=log
16+
CACHE_DRIVER=file
17+
SESSION_DRIVER=file
18+
QUEUE_DRIVER=sync
19+
20+
REDIS_HOST=127.0.0.1
21+
REDIS_PASSWORD=null
22+
REDIS_PORT=6379
23+
24+
MAIL_DRIVER=smtp
25+
MAIL_HOST=smtp.mailtrap.io
26+
MAIL_PORT=2525
27+
MAIL_USERNAME=null
28+
MAIL_PASSWORD=null
29+
MAIL_ENCRYPTION=null
30+
MAIL_FROM_NAME=
31+
32+
PUSHER_APP_ID=
33+
PUSHER_APP_KEY=
34+
PUSHER_APP_SECRET=
35+
36+
APP_TIMEZONE=Asia/Shanghai
37+
38+
WIZARD_NEED_ACTIVATE=true
39+
WIZARD_JWT_SECRET=5Dck4izVEXsP52AOcVxaFUsTzA8uwUiP
40+
WIZARD_RESOURCE_VERSION=201709071014
41+
APP_LOG=errorlog
42+
43+
WIZARD_USE_LDAP=false
44+
45+
LDAP_LOGGING=true
46+
LDAP_ACCOUNT_PREFIX=
47+
LDAP_ACCOUNT_SUFFIX=
48+
LDAP_HOSTS=
49+
LDAP_PORT=
50+
LDAP_BASE_DN=
51+
LDAP_USERNAME=
52+
LDAP_PASSWORD=
53+
LDAP_USE_SSL=false
54+
LDAP_USE_TLS=false
55+
LDAP_PASSWORD_SYNC=true
56+
LDAP_LOGIN_FALLBACK=true
57+
LDAP_SYNC_NAME_ATTR=cn
File renamed without changes.
File renamed without changes.
File renamed without changes.

docker/php/init.sh renamed to docker-compose/php/init.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cd /webroot/wizard && php /usr/bin/composer install
44

5-
cp /webroot/wizard/.env.docker /webroot/wizard/.env
5+
cp /webroot/wizard/docker-compose/.env.docker /webroot/wizard/.env
66
chown www-data:www-data -R /webroot/wizard/
77

88
php /webroot/wizard/artisan migrate --force

resources/views/auth/passwords/reset.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div class="text-left form-group{{ $errors->has('email') ? ' has-error' : '' }}">
1717
<label for="email" class="bmd-label-floating">邮箱地址</label>
18-
<input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
18+
<input id="email" type="email" class="form-control" name="email" value="{{ $email ?? old('email') }}" required autofocus>
1919

2020
@if ($errors->has('email'))
2121
<div class="invalid-feedback d-block">{{ $errors->first('email') }}</div>

resources/views/components/doc-edit.blade.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div class="row wz-editor-header">
22
{{ csrf_field() }}
3-
<input type="hidden" name="project_id" id="editor-project_id" value="{{ $project->id or '' }}"/>
4-
<input type="hidden" name="page_id" id="editor-page_id" value="{{ $pageItem->id or '' }}">
5-
<input type="hidden" name="pid" id="editor-pid" value="{{ $pageItem->pid or '' }}">
6-
<input type="hidden" name="last_modified_at" value="{{ $pageItem->updated_at or '' }}">
7-
<input type="hidden" name="history_id" value="{{ $pageItem->history_id or '' }}">
8-
<input type="hidden" name="sort_level" value="{{ $pageItem->sort_level or 1000 }}">
3+
<input type="hidden" name="project_id" id="editor-project_id" value="{{ $project->id ?? '' }}"/>
4+
<input type="hidden" name="page_id" id="editor-page_id" value="{{ $pageItem->id ?? '' }}">
5+
<input type="hidden" name="pid" id="editor-pid" value="{{ $pageItem->pid ?? '' }}">
6+
<input type="hidden" name="last_modified_at" value="{{ $pageItem->updated_at ?? '' }}">
7+
<input type="hidden" name="history_id" value="{{ $pageItem->history_id ?? '' }}">
8+
<input type="hidden" name="sort_level" value="{{ $pageItem->sort_level ?? 1000 }}">
99
<div class="col-12" style="padding-left: 0;">
1010
<div class="wz-panel-breadcrumb">
1111
<ol class="breadcrumb pull-left">
@@ -67,13 +67,13 @@ class="btn btn-default bmd-btn-icon" id="wz-document-goback">
6767
<div class="form-group">
6868
<label for="editor-title" class="bmd-label-static">@lang('document.title')</label>
6969
<input type="text" class="form-control wz-input-long" name="title" id="editor-title"
70-
value="{{ $pageItem->title or '' }}">
70+
value="{{ $pageItem->title ?? '' }}">
7171
</div>
7272

7373
@if($type === 'swagger')
7474
<div class="form-group">
7575
<label for="form-sync-url" class="bmd-label-static">文档同步地址</label>
76-
<input type="text" class="form-control wz-input-long" name="sync_url" id="editor-sync_url" value="{{ $pageItem->sync_url or '' }}" placeholder="http://"/>
76+
<input type="text" class="form-control wz-input-long" name="sync_url" id="editor-sync_url" value="{{ $pageItem->sync_url ?? '' }}" placeholder="http://"/>
7777
</div>
7878
@endif
7979
</div>
@@ -95,7 +95,7 @@ class="btn btn-default bmd-btn-icon" id="wz-document-goback">
9595
<div class="modal-body">
9696
<form method="post" action="{{ wzRoute('template:create') }}" id="wz-template-save-form">
9797
{{ csrf_field() }}
98-
<input type="hidden" name="type" value="{{ $type or 'markdown' }}"/>
98+
<input type="hidden" name="type" value="{{ $type ?? 'markdown' }}"/>
9999
<div class="form-group">
100100
<label for="template-name" class="control-label">@lang('document.template_name')</label>
101101
<input type="text" name="name" class="form-control" id="template-name">

resources/views/components/document-info.blade.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
<table class="table table-bordered">
33
<tr>
44
<th>@lang('document.last_modified_user')</th>
5-
<td>{{ $pageItem->lastModifiedUser->name or '' }}</td>
5+
<td>{{ $pageItem->lastModifiedUser->name ?? '' }}</td>
66
</tr>
77
<tr>
88
<th>@lang('document.last_modified_time')</th>
9-
<td>{{ $pageItem->updated_at or '' }}</td>
9+
<td>{{ $pageItem->updated_at ?? '' }}</td>
1010
</tr>
1111
<tr>
1212
<th>@lang('document.creator')</th>
13-
<td>{{ $pageItem->user->name or '' }}</td>
13+
<td>{{ $pageItem->user->name ?? '' }}</td>
1414
</tr>
1515
<tr>
1616
<th>@lang('document.create_time')</th>
17-
<td>{{ $pageItem->created_at or '' }}</td>
17+
<td>{{ $pageItem->created_at ?? '' }}</td>
1818
</tr>
1919
</table>
2020
</div>
2121

2222
<p class="wz-document-header">
23-
该文档由 <span class="wz-text-dashed">{{ $pageItem->user->name or '' }}</span>
24-
创建于 <span style="font-weight: bold;">{{ $pageItem->created_at or '' }} </span>,
25-
<span class="wz-text-dashed">{{ $pageItem->lastModifiedUser->name or '' }}</span>
26-
在 <span style="font-weight: bold;">{{ $pageItem->updated_at or '' }}</span> 修改了该文档。
23+
该文档由 <span class="wz-text-dashed">{{ $pageItem->user->name ?? '' }}</span>
24+
创建于 <span style="font-weight: bold;">{{ $pageItem->created_at ?? '' }} </span>,
25+
<span class="wz-text-dashed">{{ $pageItem->lastModifiedUser->name ?? '' }}</span>
26+
在 <span style="font-weight: bold;">{{ $pageItem->updated_at ?? '' }}</span> 修改了该文档。
2727
</p>

resources/views/doc/markdown.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<input type="hidden" name="type" value="markdown"/>
1313
<div class="col" style="padding-left: 0; padding-right: 0;">
1414
<div id="editormd" class="wz-markdown-style-fix">
15-
<textarea style="display:none;" name="content">{{ $pageItem->content or '' }}</textarea>
15+
<textarea style="display:none;" name="content">{{ $pageItem->content ?? '' }}</textarea>
1616
</div>
1717
</div>
1818
</div>

resources/views/doc/swagger.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
9999
// 获取swagger编辑器本次存储内容的key
100100
$.global.getDraftKey = function() {
101-
return 'swagger-editor-content-{{ $project->id or '' }}-{{ $pageItem->id or '' }}';
101+
return 'swagger-editor-content-{{ $project->id ?? '' }}-{{ $pageItem->id ?? '' }}';
102102
};
103103
104104
window.editor = SwaggerEditorBundle({

resources/views/doc/table.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@include('components.doc-edit', ['project' => $project, 'pageItem' => $pageItem ?? null, 'navigator' => $navigator])
1111
<input type="hidden" name="type" value="table" />
1212

13-
<div id="xspreadsheet-content" style="display: none;">{{ $pageItem->content or '' }}</div>
13+
<div id="xspreadsheet-content" style="display: none;">{{ $pageItem->content ?? '' }}</div>
1414
<div class="col-row" id="xspreadsheet"></div>
1515
</form>
1616
</div>
@@ -79,7 +79,7 @@
7979
8080
// 获取swagger编辑器本次存储内容的key
8181
$.global.getDraftKey = function() {
82-
return 'x-spreadsheet-content-{{ $project->id or '' }}-{{ $pageItem->id or '' }}';
82+
return 'x-spreadsheet-content-{{ $project->id ?? '' }}-{{ $pageItem->id ?? '' }}';
8383
};
8484
8585
// 更新编辑器内容

0 commit comments

Comments
 (0)