Skip to content

Commit 95344e5

Browse files
authoredJun 13, 2020
Merge pull request #841 from CoronaWhy/fix/aws-deploy
Fix aws deploy
2 parents 7aa790a + 92016a9 commit 95344e5

File tree

2 files changed

+84
-3
lines changed

2 files changed

+84
-3
lines changed
 

‎app/app/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@
314314
EMAIL_HOST_USER = env('EMAIL_HOST_USER', None)
315315
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD', None)
316316
EMAIL_PORT = env.int('EMAIL_PORT', 587)
317+
DEFAULT_FROM_EMAIL = env('DEFAULT_FROM_EMAIL', 'webmaster@localhost')
317318

318319
if not EMAIL_HOST:
319320
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

‎awsdeploy.yml

+83-3
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,51 @@ Resources:
7575
- !Ref SecretKey
7676
- |+
7777
78+
- sudo tee -a /env.list <<< EMAIL_USE_TLS=
79+
- !Ref EMailUseTSL
80+
- |+
81+
82+
- sudo tee -a /env.list <<< EMAIL_HOST=
83+
- !Ref EMailHost
84+
- |+
85+
86+
- sudo tee -a /env.list <<< EMAIL_PORT=
87+
- !Ref EMailHostPort
88+
- |+
89+
90+
- sudo tee -a /env.list <<< EMAIL_HOST_USER=
91+
- !Ref EMailHostUser
92+
- |+
93+
94+
- sudo tee -a /env.list <<< EMAIL_HOST_PASSWORD=
95+
- !Ref EMailHostPassword
96+
- |+
97+
98+
- sudo tee -a /env.list <<< WORKERS=
99+
- !Ref WorkersCount
100+
- |+
101+
102+
- sudo tee -a /env.list <<< DEFAULT_FROM_EMAIL=
103+
- !Ref FromEmail
104+
- |+
105+
106+
- sudo tee -a /env.list <<< DOCKER_IMAGE=
107+
- !Ref DockerImageName
108+
- |+
109+
78110
- |
79111
set -a
80112
- |
81113
source /env.list
82114
- |
83115
set +a
84116
- |
85-
sudo docker pull doccano/doccano:latest
117+
sudo docker pull ${DOCKER_IMAGE}
86118
- >
87119
sudo docker run -d --name doccano --env-file /env.list -p 80:8000
88-
doccano/doccano:latest
120+
${DOCKER_IMAGE}
89121
- >
90-
sudo docker exec doccano tools/create-admin.sh ${ADMIN} ${EMAIL}
122+
sleep 3 && sudo docker exec doccano tools/create-admin.sh ${ADMIN} ${EMAIL}
91123
${PASSWORD}
92124
Metadata:
93125
'AWS::CloudFormation::Designer':
@@ -195,6 +227,7 @@ Parameters:
195227
ConstraintDescription: must be the name of an existing EC2 KeyPair.
196228
AdminUserName:
197229
Description: The admin account user name
230+
Default: 'admin'
198231
Type: String
199232
MinLength: 1
200233
MaxLength: 16
@@ -224,6 +257,53 @@ Parameters:
224257
Description: Secret key for Django
225258
Type: String
226259
AllowedPattern: '^[a-zA-Z0-9]*$'
260+
EMailUseTSL:
261+
Default: 'False'
262+
AllowedValues:
263+
- 'False'
264+
- 'True'
265+
Description: SMTP will use TSL
266+
Type: String
267+
AllowedPattern: '^[a-zA-Z0-9]*$'
268+
EMailHost:
269+
Description: SMTP Host
270+
Type: String
271+
AllowedPattern: '^[\w-]+(\.[\w-]+)*(\.[a-z]{2,})$'
272+
EMailHostUser:
273+
Description: SMTP Host User
274+
Type: String
275+
MinLength: 1
276+
MaxLength: 25
277+
AllowedPattern: '^[a-zA-Z0-9][a-zA-Z0-9]{1,25}$'
278+
EMailHostPassword:
279+
Description: SMTP Host User password
280+
Type: String
281+
NoEcho: true
282+
MinLength: 0
283+
MaxLength: 60
284+
AllowedPattern: '^\p{Graph}+$'
285+
EMailHostPort:
286+
Description: SMTP Port
287+
Type: String
288+
MinLength: 1
289+
MaxLength: 5
290+
AllowedPattern: '^\d+$'
291+
WorkersCount:
292+
Description: Workers Count
293+
Type: String
294+
MinLength: 1
295+
MaxLength: 3
296+
AllowedPattern: '^\d+$'
297+
FromEmail:
298+
Default: webmaster@localhost
299+
Description: The email used to send from singup messages
300+
Type: String
301+
AllowedPattern: '^[\x20-\x45]?[\w-\+]+(\.[\w]+)*@[\w-]+(\.[\w]+)*(\.[a-z]{2,})?$'
302+
DockerImageName:
303+
Default: doccano/doccano:latest
304+
Description: The Docker image name
305+
Type: String
306+
AllowedPattern: '^[\w_-]+/[\w_-]+:[\w_-]+$'
227307
Outputs:
228308
PublicDNS:
229309
Value: !GetAtt

0 commit comments

Comments
 (0)
Please sign in to comment.