Skip to content

Commit 3ba9cff

Browse files
xepozzStyleCIBot
andauthored
Set up crontab for certbot renew (#578)
* Set up crontab for certbot renew * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <[email protected]>
1 parent 20e27ab commit 3ba9cff

File tree

15 files changed

+93
-3
lines changed

15 files changed

+93
-3
lines changed

ansible/roles/certbot/tasks/update_certificates.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,23 @@
1616
args:
1717
chdir: /home/deploy/demo.yiiframework.com
1818
shell: docker-compose -f docker-compose.yml exec gateway nginx -t && docker-compose -f docker-compose.yml exec gateway nginx -s reload
19+
20+
# Crontab file location is /var/spool/cron/crontabs/deploy
21+
# Every 2nd month on 15th day of month
22+
# See https://crontab.guru/#0_0_15_*/2_*
23+
- name: Set periodic certificates update
24+
cron:
25+
name: certbot-renew
26+
user: deploy
27+
minute: '0'
28+
hour: '0'
29+
day: '15'
30+
month: '*/2'
31+
job: >
32+
/bin/bash -c "
33+
cd /home/deploy/demo.yiiframework.com &&
34+
docker-compose -f docker-compose.yml up certbot &&
35+
sleep 180 &&
36+
docker-compose -f docker-compose.yml exec -T gateway nginx -t &&
37+
docker-compose -f docker-compose.yml exec -T gateway nginx -s reload
38+
"

blog-api/config/web/di/application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Yiisoft\Yii\Http\Application::class => [
1515
'__construct()' => [
1616
'dispatcher' => DynamicReference::to(static function (Injector $injector) use ($params) {
17-
return ($injector->make(MiddlewareDispatcher::class))
17+
return $injector->make(MiddlewareDispatcher::class)
1818
->withMiddlewares($params['middlewares']);
1919
}),
2020
'fallbackHandler' => Reference::to(NotFoundHandler::class),

blog-api/src/Auth/AuthController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ public function __construct(
4242
* path="/auth/",
4343
* summary="Authenticate by params",
4444
* description="",
45+
*
4546
* @OA\Response(
4647
* response="200",
4748
* description="Success",
49+
*
4850
* @OA\JsonContent(
4951
* allOf={
52+
*
5053
* @OA\Schema(ref="#/components/schemas/Response"),
5154
* @OA\Schema(
55+
*
5256
* @OA\Property(
5357
* property="data",
5458
* type="object",
@@ -58,15 +62,20 @@ public function __construct(
5862
* },
5963
* )
6064
* ),
65+
*
6166
* @OA\Response(
6267
* response="400",
6368
* description="Bad request",
69+
*
6470
* @OA\JsonContent(ref="#/components/schemas/BadResponse")
6571
* ),
72+
*
6673
* @OA\RequestBody(
6774
* required=true,
75+
*
6876
* @OA\MediaType(
6977
* mediaType="application/json",
78+
*
7079
* @OA\Schema(ref="#/components/schemas/AuthRequest"),
7180
* ),
7281
* ),
@@ -93,14 +102,18 @@ public function login(AuthRequest $request): ResponseInterface
93102
* summary="Logout",
94103
* description="",
95104
* security={{"ApiKey": {}}},
105+
*
96106
* @OA\Response(
97107
* response="200",
98108
* description="Success",
109+
*
99110
* @OA\JsonContent(ref="#/components/schemas/Response")
100111
* ),
112+
*
101113
* @OA\Response(
102114
* response="400",
103115
* description="Bad request",
116+
*
104117
* @OA\JsonContent(ref="#/components/schemas/BadResponse")
105118
* ),
106119
* )

blog-api/src/Auth/AuthRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/**
1313
* @OA\Schema(
1414
* schema="AuthRequest",
15+
*
1516
* @OA\Property(example="Opal1144", property="login", format="string"),
1617
* @OA\Property(example="Opal1144", property="password", format="string"),
1718
* )

blog-api/src/Blog/BlogController.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
* name="blog",
1818
* description="Blog"
1919
* )
20+
*
2021
* @OA\Parameter(
22+
*
2123
* @OA\Schema(
2224
* type="int",
2325
* example="2"
@@ -55,22 +57,29 @@ public function __construct(
5557
* path="/blog/",
5658
* summary="Returns paginated blog posts",
5759
* description="",
60+
*
5861
* @OA\Parameter(ref="#/components/parameters/PageRequest"),
62+
*
5963
* @OA\Response(
6064
* response="200",
6165
* description="Success",
66+
*
6267
* @OA\JsonContent(
6368
* allOf={
69+
*
6470
* @OA\Schema(ref="#/components/schemas/Response"),
6571
* @OA\Schema(
72+
*
6673
* @OA\Property(
6774
* property="data",
6875
* type="object",
6976
* @OA\Property(
7077
* property="posts",
7178
* type="array",
79+
*
7280
* @OA\Items(ref="#/components/schemas/Post")
7381
* ),
82+
*
7483
* @OA\Property(
7584
* property="paginator",
7685
* type="object",
@@ -105,19 +114,25 @@ public function index(PaginatorFormatter $paginatorFormatter, #[Query('page')] i
105114
* path="/blog/{id}",
106115
* summary="Returns a post with a given ID",
107116
* description="",
117+
*
108118
* @OA\Parameter(
119+
*
109120
* @OA\Schema(type="int", example="2"),
110121
* in="path",
111122
* name="id",
112123
* parameter="id"
113124
* ),
125+
*
114126
* @OA\Response(
115127
* response="200",
116128
* description="Success",
129+
*
117130
* @OA\JsonContent(
118131
* allOf={
132+
*
119133
* @OA\Schema(ref="#/components/schemas/Response"),
120134
* @OA\Schema(
135+
*
121136
* @OA\Property(
122137
* property="data",
123138
* type="object",
@@ -131,13 +146,17 @@ public function index(PaginatorFormatter $paginatorFormatter, #[Query('page')] i
131146
* },
132147
* )
133148
* ),
149+
*
134150
* @OA\Response(
135151
* response="404",
136152
* description="Not found",
153+
*
137154
* @OA\JsonContent(
138155
* allOf={
156+
*
139157
* @OA\Schema(ref="#/components/schemas/BadResponse"),
140158
* @OA\Schema(
159+
*
141160
* @OA\Property(property="error_message", example="Entity not found"),
142161
* @OA\Property(property="error_code", nullable=true, example=404)
143162
* ),
@@ -164,17 +183,22 @@ public function view(#[Route('id')] int $id): Response
164183
* summary="Creates a blog post",
165184
* description="",
166185
* security={{"ApiKey": {}}},
186+
*
167187
* @OA\Response(
168188
* response="200",
169189
* description="Success",
190+
*
170191
* @OA\JsonContent(
171192
* ref="#/components/schemas/Response"
172193
* )
173194
* ),
195+
*
174196
* @OA\RequestBody(
175197
* required=true,
198+
*
176199
* @OA\MediaType(
177200
* mediaType="application/json",
201+
*
178202
* @OA\Schema(ref="#/components/schemas/EditPostRequest"),
179203
* ),
180204
* ),
@@ -197,23 +221,30 @@ public function create(EditPostRequest $postRequest, UserRequest $userRequest):
197221
* summary="Updates a blog post with a given ID",
198222
* description="",
199223
* security={{"ApiKey": {}}},
224+
*
200225
* @OA\Parameter(
226+
*
201227
* @OA\Schema(type="int", example="2"),
202228
* in="path",
203229
* name="id",
204230
* parameter="id"
205231
* ),
232+
*
206233
* @OA\Response(
207234
* response="200",
208235
* description="Success",
236+
*
209237
* @OA\JsonContent(
210238
* ref="#/components/schemas/Response"
211239
* )
212240
* ),
241+
*
213242
* @OA\RequestBody(
214243
* required=true,
244+
*
215245
* @OA\MediaType(
216246
* mediaType="application/json",
247+
*
217248
* @OA\Schema(ref="#/components/schemas/EditPostRequest"),
218249
* ),
219250
* )

blog-api/src/Blog/EditPostRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* @OA\Schema(
1616
* schema="EditPostRequest",
17+
*
1718
* @OA\Property(example="Title post", property="title", format="string"),
1819
* @OA\Property(example="Text post", property="text", format="string"),
1920
* @OA\Property(example=1, property="status", format="int"),

blog-api/src/Blog/PostFormatter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/**
1010
* @OA\Schema(
1111
* schema="Post",
12+
*
1213
* @OA\Property(example="100", property="id", format="int"),
1314
* @OA\Property(example="Title", property="title", format="string"),
1415
* @OA\Property(example="Text", property="content", format="string"),

blog-api/src/Dto/ApiResponseData.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* allOf={
1616
* @OA\Schema(ref="#/components/schemas/Response"),
1717
* @OA\Schema(
18+
*
1819
* @OA\Property(
1920
* property="status",
2021
* example="failed",

blog-api/src/Formatter/PaginatorFormatter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/**
1111
* @OA\Schema(
1212
* schema="Paginator",
13+
*
1314
* @OA\Property(example="10", property="pageSize", format="int"),
1415
* @OA\Property(example="1", property="currentPage", format="int"),
1516
* @OA\Property(example="3", property="totalPages", format="int"),

blog-api/src/InfoController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ public function __construct(private VersionProvider $versionProvider)
2222
* path="/",
2323
* summary="Returns info about the API",
2424
* description="",
25+
*
2526
* @OA\Response(
2627
* response="200",
2728
* description="Success",
29+
*
2830
* @OA\JsonContent(
2931
* allOf={
32+
*
3033
* @OA\Schema(ref="#/components/schemas/Response"),
3134
* @OA\Schema(
35+
*
3236
* @OA\Property(
3337
* property="data",
3438
* type="object",

0 commit comments

Comments
 (0)