-
Notifications
You must be signed in to change notification settings - Fork 0
/
howto.txt
executable file
·122 lines (90 loc) · 4.06 KB
/
howto.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
###############################################################################################################
#
# A) Local Build
# BerlinAPPle Docker Java Base Image
# only, if java_base images changes)
# in Bash
cd /b/berlinapple
docker build . -f Dockerfile.java_base -t mrtnlhmnn/berlinapple_java_base --no-cache --force-rm
# optional (Attention: Do not copy pw directly from activ'aid to shell!)
# docker login -u mrtnlhmnn
docker push mrtnlhmnn/berlinapple_java_base
###############################################################################################################
#
# B) Local Build
# BerlinAPPle Docker Image
#
# in IntelliJ
mvn install
# in Bash
cd /b/berlinapple
docker build . -f Dockerfile -t mrtnlhmnn/berlinapple --no-cache --force-rm
# optional (Attention: Do not copy pw directly from activ'aid to shell!)
# docker login -u mrtnlhmnn
docker push mrtnlhmnn/berlinapple
###############################################################################################################
#
# C) Browser - AWS Login and EC2 Instance start
# Create AWS EC2 instance
#
# Currently, all EC2 instances are stopped?!
# Need to start a new one, so the AWS's "Public IPv4 DNS" below will change!
# What to use? This should be fine:
# A "t2.micro" is more than enough for our needs.
# Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-0df0e7600ad0913a9 (64-bit x86) / ami-0a3ab28b9d065f7c5 (64-bit Arm)
# 64-bit (x86)
1) Login
https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Feu-central-1.console.aws.amazon.com%2Fec2%2Fv2%2Fhome%3Fregion%3Deu-central-1%26state%3DhashArgs%2523Instances%253Asort%253DinstanceId%26isauthcode%3Dtrue&client_id=arn%3Aaws%3Aiam%3A%3A015428540659%3Auser%2Fec2&forceMobileApp=0&code_challenge=t5HoiXNn0t79zebaq1zp4rZZg-y3jc_5jWGfL45-_GE&code_challenge_method=SHA-256
with [email protected]
2) EC2, Launch Instance
- EC2
- t2.micro
- Key pair name: berlinapple
- HTTPS, HTTP and SSH -> select all
3) Login per SSH
ssh [email protected] -i /c/lehmann/spielwiese/berlinapple/orga/berlinapple.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/c/lehmann/spielwiese/berlinapple/orga/berlinapple.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/c/lehmann/spielwiese/berlinapple/orga/berlinapple.pem": bad permissions
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
-> Permissions due not work for Windows files, copy/move then to WSL filesystem like ~/berlinapple kopieren - and then chmod 700
###############################################################################################################
#
# D) EC2 SSH Remote access, Docker start
# Deploy and run on AWS EC2 instance
#
# optional, if no docker installed
# sudo yum install -y docker
# optional, only if docker daemon not running on the EC2 instance
# sudo service docker start
sudo docker ps
sudo docker stop PID
sudo docker container ls --all
sudo docker rm <CONTAINERID>
sudo docker images
sudo docker rmi <IMAGEID>
sudo docker run -d -p 80:8080 docker.io/mrtnlhmnn/berlinapple
> <ZZZID>
# Watch logs
watch sudo docker logs <ZZZID>
# Or login, check /app/logs there
sudo docker exec -it <ZZZID> bash
###############################################################################################################
#
# E) BerlinAPPle access
# Web access via HTTP
#
# Now these URLs (or similar *) should be working:
http://ec2-3-65-11-118.eu-central-1.compute.amazonaws.com/
http://ec2-3-65-11-118.eu-central-1.compute.amazonaws.com/version
###############################################################################################################
#
# F) berlinapple.de redirect
#
# If all is working, change the redirect from berlinapple.de. So go to
https://mein.ionos.de/domain-details/berlinapple.de
# Change "Ziel der Weiterleitung"