wiki/info/landscape/amazon-ec2.md
... ...
@@ -12,82 +12,22 @@
12 12
13 13
#### Starting an instance
14 14
15
+To start with, your user account needs to have sufficient permissions to create a new server group ``{NEWSERVERNAME}-server`` up-front so that you have at least the permissions granted by the ``user`` role for all objects owned by that group. Change the group's group ownership so that the new group is its own group owner. Additionally, in order to have the new server participate in the shared security service and shared sailing data service on ``security-service.sapsailing.com`` your user needs ``SERVER:REPLICATE:security-service``. Your user should also have the ``SERVER:*:{NEWSERVERNAME}`` permission (e.g., implied by the more general ``SERVER:*`` permission), e.g., granted by the ``server_admin`` role. The latter permission is helpful in order to be able to configure the resulting server and to set up replication for it. If your user account currently does not have those permissions, find an administrator who has at least ``SERVER:*`` which is implied in particular by having role ``server_admin:*``. Such an administrator will be able to grant you the ``SERVER``-related permissions described here.
15 16
16
-- Which instance type to choose:
17
- - Archive: m2.2xlarge
18
- - Live: c1.xlarge
17
+Now start by creating the new server group, named ``{NEWSERVERNAME}-server``. So for example, if your server will use ``SERVER_NAME=abc`` then create a user group called ``abc-server``. You will yourself be a member of that new group automatically. Add role ``user`` to the group, enabling it only for the members of the group ("Enabled for all users" set to "No"). This way, all members of the group will gain permissions for objects owned by that server as if they owned them themselves. This also goes for the new ``SERVER`` object, but owners only obtain permissions for default actions, not the dedicated ``SERVER`` actions.
19 18
20
-You may need to select "All generations" instead of "Current generation" to see these instance configurations. Of course, you may choose variations of those as you feel is appropriate for your use case.
21
-
22
-- Using a release, set the following in the instance's user data, replacing `myspecificevent` by a unique name of the event or series you'll be running on that instance, such as `kielerwoche2014` or similar.
23
-
24
- ```
25
- INSTALL_FROM_RELEASE=`name-of-release`
26
- USE_ENVIRONMENT=live-server
27
- MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
28
- REPLICATION_CHANNEL=myspecificevent
29
- SERVER_NAME=MYSPECIFICEVENT
30
- BUILD_COMPLETE_NOTIFY=your@email.here
31
- SERVER_STARTUP_NOTIFY=your@email.here
32
- ADDITIONAL_JAVA_ARGS="$ADDITIONAL_JAVA_ARGS -Dcom.sap.sailing.domain.tracking.MailInvitationType=SailInsight2"
33
- # Provide authentication credentials for a user on security-service.sapsailing.com permitted to replicate, either by username/password...
34
- #REPLICATE_MASTER_USERNAME=(user for replicator login on security-service.sapsailing.com server having SERVER:REPLICATE:<server-name> permission)
35
- #REPLICATE_MASTER_PASSWORD=(password of the user for replication login on security-service.sapsailing.com)
36
- # Or by bearer token, obtained, e.g., through
37
- # curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
38
- # or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
39
- # https://security-service.sapsailing.com/security/api/restsecurity/access_token
40
- #REPLICATE_MASTER_BEARER_TOKEN=
41
-```
42
-
43
-The *MailInvitationType* property controls which version of the SAP Sail Insight app will be targeted by tracking invitations sent out by e-mail.
44
-Two different Branch.io URL schemes exist for the Sail Insight app: sailinsight-app.sapsailing.com and sailinsight20-app.sapsailing.com.
45
-They can be selected by providing *SailInsight1* or *SailInsight2*, respectively, as the values for the property. If the property is
46
-set to *LEGACY*, no Branch.io link is used in the invitation at all. This mode should no longer be used because the Branch.io-enabled
47
-iOS app has hit the store. If not provided, it will default to *SailInsight2*.
48
-
49
-Note that when you select to install an environment using the `USE_ENVIRONMENT` variable, any other variable that you specify in the user data, such as the `MONGODB_URI` or `REPLICATION_CHANNEL` properties in the example above, these additional user data properties will override whatever comes from the environment specified by the `USE_ENVIRONMENT` parameter.
50
-
51
-- To build from git, install and start, set the following in the instance's user data, adjusting the branch name (`BUILD_FROM`), the `myspecificevent` naming and memory settings according to your needs:
52
-
53
-```
54
- BUILD_BEFORE_START=True
55
- BUILD_FROM=master
56
- RUN_TESTS=False
57
- COMPILE_GWT=True
58
- BUILD_COMPLETE_NOTIFY=you@email.com
59
- SERVER_STARTUP_NOTIFY=
60
- SERVER_NAME=MYSPECIFICEVENT
61
- MEMORY=2048m
62
- REPLICATION_HOST=rabbit.internal.sapsailing.com
63
- REPLICATION_CHANNEL=myspecificevent
64
- MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
65
- # Provide authentication credentials for a user on security-service.sapsailing.com permitted to replicate, either by username/password...
66
- #REPLICATE_MASTER_USERNAME=(user for replicator login on security-service.sapsailing.com server having SERVER:REPLICATE:<server-name> permission)
67
- #REPLICATE_MASTER_PASSWORD=(password of the user for replication login on security-service.sapsailing.com)
68
- # Or by bearer token, obtained, e.g., through
69
- # curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
70
- # or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
71
- # https://security-service.sapsailing.com/security/api/restsecurity/access_token
72
- #REPLICATE_MASTER_BEARER_TOKEN=
73
-```
74
-
75
-#### Setting up a new image (AMI) from scratch (more or less)
76
-
77
-See [here](/wiki/creating-ec2-image-from-scratch)
78
-
79
-#### Receiving wind from Expedition
19
+Now choose the instance type to start. For example:
20
+ - Archive server: i3.2xlarge
21
+ - Live event: c4.2xlarge
80 22
81
-- To receive and forward wind with an Expedition connector, log into webserver as user trac and switch to $HOME/servers/udpmirror. Start the mirror and forward it to the instance you want. In order to receive wind through the Igtimi connector, this step is not required as the wind data is received directly from the Igtimi server.
82
-
83
-#### Setting up Master and Replica
23
+You may need to select "All generations" instead of "Current generation" to see these instance configurations. Of course, you may choose variations of those as you feel is appropriate for your use case.
84 24
85
-- Fire up a master with the following configuration. There is a preconfigured master environment at http://releases.sapsailing.com/environments/live-master-server that you should use.
25
+Using a release, set the following in the instance's user data, replacing `myspecificevent` by a unique name of the event or series you'll be running on that instance, such as `kielerwoche2014` or similar. Note that when you select to install an environment using the `USE_ENVIRONMENT` variable, any other variable that you specify in the user data, such as the `MONGODB_URI` or `REPLICATION_CHANNEL` properties in the example above, these additional user data properties will override whatever comes from the environment specified by the `USE_ENVIRONMENT` parameter.
86 26
87 27
```
88 28
INSTALL_FROM_RELEASE=(name-of-release)
89 29
USE_ENVIRONMENT=live-master-server
90
-SERVER_NAME=MYSPECIFICEVENT
30
+SERVER_NAME=myspecificevent
91 31
REPLICATION_CHANNEL=myspecificevent
92 32
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent?replicaSet=live&retryWrites=true"
93 33
SERVER_STARTUP_NOTIFY=you@email.com
... ...
@@ -98,17 +38,22 @@ SERVER_STARTUP_NOTIFY=you@email.com
98 38
# curl -d "username=myuser&password=mysecretpassword" "https://security-service.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
99 39
# or by logging in to the security-service.sapsailing.com server using your web browser and then navigating to
100 40
# https://security-service.sapsailing.com/security/api/restsecurity/access_token
101
-#REPLICATE_MASTER_BEARER_TOKEN=
41
+REPLICATE_MASTER_BEARER_TOKEN=(a bearer token allowing this master to replicate from security-service.sapsailing.com)
102 42
```
103 43
104
-- After your master server is ready, note the internal IP and configure your replica instances. Set up a user account there that has the following permission: ``SERVER:REPLICATE:{SERVERNAME}``. You will need this user's credentials to authenticate your replicas for replication.
44
+Have at least a public-facing target group ready. If you want to expose the master to the public (single-instance scenario or master-replica scenario where the master also handles reading client requests) add the master to the public target group.
105 45
106
-- Make sure to use the preconfigured environment from http://releases.sapsailing.com/environments/live-replica-server. Then absolutely make sure to add the line "REPLICATE_MASTER_SERVLET_HOST" to the user-data and adjust the `myspecificevent` master exchange name to the `REPLICATION_CHANNEL` setting you used for the master configuration.
46
+If you want to launch one or more replicas, ensure you have a dedicated ``...-master`` target group to which you add your master instance, and a load balancer rule that forwards your replica's requests directed to the master to that ``...-master`` target group, for example, by using a dedicated ``...-master`` hostname rule in your load balancer which then forwards to the ``...-master`` target group.
47
+
48
+After your master server is ready, note the internal IP and configure your replica instances if you'd like to connect using the master's IP address. Alternatively, you may route the replica requests through the load balancer again, using whatever your load balancer requires to route the requests to your master, such as the ``...-master`` hostname with HTTPS as a protocol and 443 for a port. If you don't want to use the credentials of your own user account (which is expected to have permission ``SERVER:REPLICATE:{SERVERNAME}`` already because as described above you need this for configuring the new server), e.g., because you then have to expose an access token in the environment that anyone with SSH access to the instance may be able to see, set up a new user account, such as ``{SERVERNAME}-replicator``, that has the following permission: ``SERVER:REPLICATE:{SERVERNAME}`` where ``{SERVERNAME}`` is what you provided above for the ``SERVER_NAME`` environment variable. You will be able to grant this permission to the new user because your own user account is expected to have this permission. You will need your own or this new user's credentials to authenticate your replicas for replication.
49
+
50
+Make sure to use the preconfigured environment from http://releases.sapsailing.com/environments/live-replica-server. Then absolutely make sure to add the line "REPLICATE_MASTER_SERVLET_HOST" to the user-data and adjust the `myspecificevent` master exchange name in the replica's ``REPLICATE_MASTER_EXCHANGE_NAME`` variable to the value of the ``REPLICATION_CHANNEL`` setting you used for the master configuration. Also ensure that you provide the ``REPLICATE_MASTER_BEARER_TOKEN`` value (or, alternatively ``REPLICATE_MASTER_USERNAME`` and ``REPLICATE_MASTER_PASSWORD``) to grant the replica the permissions it needs to successfully register with the master as a replica.
107 51
108 52
```
109 53
INSTALL_FROM_RELEASE=(name-of-release)
110 54
USE_ENVIRONMENT=live-replica-server
111
-REPLICATE_MASTER_SERVLET_HOST=(IP of your master server)
55
+REPLICATE_MASTER_SERVLET_HOST=(IP of your master server or external -master hostname)
56
+REPLICATE_MASTER_SERVLET_PORT=(port your master is listening on for HTTP/HTTPS requests; defaults to 8888; use 443 for -master hostname)
112 57
REPLICATE_MASTER_EXCHANGE_NAME=myspecificevent
113 58
# Provide authentication credentials for a user on the master permitted to replicate, either by username/password...
114 59
#REPLICATE_MASTER_USERNAME=(user for replicator login on master server having SERVER:REPLICATE:<server-name> permission)
... ...
@@ -117,13 +62,21 @@ REPLICATE_MASTER_EXCHANGE_NAME=myspecificevent
117 62
# curl -d "username=myuser&password=mysecretpassword" "https://master-server.sapsailing.com/security/api/restsecurity/access_token" | jq .access_token
118 63
# or by logging in to the master server using your web browser and then navigating to
119 64
# https://master-server.sapsailing.com/security/api/restsecurity/access_token
120
-# REPLICATE_MASTER_BEARER_TOKEN=
65
+REPLICATE_MASTER_BEARER_TOKEN=(a bearer token allowing this master to replicate from your master)
121 66
SERVER_NAME=MYSPECIFICEVENT
122 67
MONGODB_URI="mongodb://mongo0.internal.sapsailing.com,mongo1.internal.sapsailing.com/myspecificevent-replica?replicaSet=live&retryWrites=true"
123 68
EVENT_ID=<some-uuid-of-an-event-you-want-to-feature>
124 69
SERVER_STARTUP_NOTIFY=you@email.com
125 70
```
126 71
72
+#### Setting up a new image (AMI) from scratch (more or less)
73
+
74
+See [here](/wiki/creating-ec2-image-from-scratch)
75
+
76
+#### Receiving wind from Expedition
77
+
78
+- To receive and forward wind with an Expedition connector, log into webserver as user trac and switch to $HOME/servers/udpmirror. Start the mirror and forward it to the instance you want. In order to receive wind through the Igtimi connector, this step is not required as the wind data is received directly from the Igtimi server.
79
+
127 80
#### Setting up a Multi Instance
128 81
To set up a multi instance for a server with name "SSV", subdomain "ssv.sapsailing.com" and description "Schwartauer Segler-Verein, [www.ssv-net.de](http://www.ssv-net.de), Alexander Probst, [webmaster@alexprobst.de](mailto:webmaster@alexprobst.de)" perform the following steps:
129 82