diff options
Diffstat (limited to 'roles/contexts/fretlink')
-rwxr-xr-x | roles/contexts/fretlink/files/workdir/start | 14 | ||||
-rw-r--r-- | roles/contexts/fretlink/templates/environment.j2 | 60 |
2 files changed, 72 insertions, 2 deletions
diff --git a/roles/contexts/fretlink/files/workdir/start b/roles/contexts/fretlink/files/workdir/start index 840943a..8f440bf 100755 --- a/roles/contexts/fretlink/files/workdir/start +++ b/roles/contexts/fretlink/files/workdir/start | |||
@@ -1,6 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | APP="$1" | 3 | APP="$1" |
4 | shift | ||
4 | 5 | ||
5 | if [ -z "$APP" ]; then | 6 | if [ -z "$APP" ]; then |
6 | if [ $(dirname $(pwd)) = "$HOME/workdir" ]; then | 7 | if [ $(dirname $(pwd)) = "$HOME/workdir" ]; then |
@@ -11,9 +12,12 @@ if [ -z "$APP" ]; then | |||
11 | fi | 12 | fi |
12 | fi | 13 | fi |
13 | 14 | ||
14 | if [ "$APP" != "psql" ]; then | 15 | if [ "$APP" != "psql" -a "$APP" != "pg_restore" ]; then |
15 | cd $HOME/workdir/$APP | 16 | cd $HOME/workdir/$APP |
16 | source ../environment | 17 | source ../environment |
18 | elif [ "$APP" = "pg_restore" ]; then | ||
19 | source ../environment | ||
20 | APP=pg_restore | ||
17 | else | 21 | else |
18 | source ../environment | 22 | source ../environment |
19 | APP=psql | 23 | APP=psql |
@@ -41,14 +45,22 @@ function start_psql() { | |||
41 | psql -h $POSTGRESQL_ADDON_HOST -p $POSTGRESQL_ADDON_PORT -U $POSTGRESQL_ADDON_USER -d $POSTGRESQL_ADDON_DB | 45 | psql -h $POSTGRESQL_ADDON_HOST -p $POSTGRESQL_ADDON_PORT -U $POSTGRESQL_ADDON_USER -d $POSTGRESQL_ADDON_DB |
42 | } | 46 | } |
43 | 47 | ||
48 | function start_pg_restore() { | ||
49 | export PGPASSWORD=$POSTGRESQL_ADDON_PASSWORD | ||
50 | pg_restore -h $POSTGRESQL_ADDON_HOST -p $POSTGRESQL_ADDON_PORT -U $POSTGRESQL_ADDON_USER -d $POSTGRESQL_ADDON_DB | ||
51 | } | ||
52 | |||
44 | case "$APP${FLAVOR:+-}$FLAVOR" in | 53 | case "$APP${FLAVOR:+-}$FLAVOR" in |
45 | "psql") start_psql;; | 54 | "psql") start_psql;; |
55 | "pg_restore") start_pg_restore;; | ||
46 | "app") start_app;; | 56 | "app") start_app;; |
47 | "admin-root") start_stack server;; | 57 | "admin-root") start_stack server;; |
58 | "admin-user") start_stack server;; | ||
48 | "carrier-directory") start_stack server;; | 59 | "carrier-directory") start_stack server;; |
49 | "freight") start_stack freight-server;; | 60 | "freight") start_stack freight-server;; |
50 | "notifier") start_stack notifier-exe;; | 61 | "notifier") start_stack notifier-exe;; |
51 | "notifier-amqp") start_stack notifier-exe-amqp;; | 62 | "notifier-amqp") start_stack notifier-exe-amqp;; |
52 | "pricer") start_stack pricer;; | 63 | "pricer") start_stack pricer;; |
64 | "third-parties") start_stack server;; | ||
53 | "toolbox") start_stack toolbox-api;; | 65 | "toolbox") start_stack toolbox-api;; |
54 | esac | 66 | esac |
diff --git a/roles/contexts/fretlink/templates/environment.j2 b/roles/contexts/fretlink/templates/environment.j2 index 652fc8d..85d3dc7 100644 --- a/roles/contexts/fretlink/templates/environment.j2 +++ b/roles/contexts/fretlink/templates/environment.j2 | |||
@@ -50,6 +50,11 @@ APP=$(basename $(pwd)) | |||
50 | FL_APPS_HOST="localhost" | 50 | FL_APPS_HOST="localhost" |
51 | FL_APPS_SCHEME="http" | 51 | FL_APPS_SCHEME="http" |
52 | 52 | ||
53 | FL_ADMIN_USER_PORT=8078 | ||
54 | FL_ADMIN_USER_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/AdminUser subkey=Secret') }}" | ||
55 | FL_ADMIN_USER_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/AdminUser subkey=PrivateKey') }}" | ||
56 | FL_ADMIN_USER_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_ADMIN_ROOT_PORT/api/" | ||
57 | |||
53 | FL_ADMIN_ROOT_PORT=8079 | 58 | FL_ADMIN_ROOT_PORT=8079 |
54 | FL_ADMIN_ROOT_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/AdminRoot subkey=PrivateKey') }}" | 59 | FL_ADMIN_ROOT_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/AdminRoot subkey=PrivateKey') }}" |
55 | FL_ADMIN_ROOT_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_ADMIN_ROOT_PORT/api/" | 60 | FL_ADMIN_ROOT_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_ADMIN_ROOT_PORT/api/" |
@@ -69,12 +74,18 @@ FL_NOTIFIER_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Notif | |||
69 | FL_NOTIFIER_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Notifier subkey=PrivateKey') }}" | 74 | FL_NOTIFIER_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Notifier subkey=PrivateKey') }}" |
70 | FL_NOTIFIER_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_NOTIFIER_PORT/api" | 75 | FL_NOTIFIER_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_NOTIFIER_PORT/api" |
71 | 76 | ||
77 | FL_THIRD_PARTIES_PORT=8086 | ||
78 | FL_THIRD_PARTIES_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/ThirdParties subkey=Secret') }}" | ||
79 | |||
72 | FL_PRICER_PORT=8083 | 80 | FL_PRICER_PORT=8083 |
73 | FL_PRICER_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Pricer subkey=PrivateKey') }}" | 81 | FL_PRICER_PRIVATE_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Pricer subkey=PrivateKey') }}" |
82 | FL_PRICER_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Pricer subkey=Secret') }}" | ||
74 | 83 | ||
75 | FL_FREIGHT_PORT=8084 | 84 | FL_FREIGHT_PORT=8084 |
76 | FL_FREIGHT_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Freight subkey=Secret') }}" | 85 | FL_FREIGHT_SECRET="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/Freight subkey=Secret') }}" |
77 | 86 | ||
87 | FL_HOMEPAGE_PORT=8085 | ||
88 | |||
78 | FL_BOOKKEEPING_SECRET="dummy" | 89 | FL_BOOKKEEPING_SECRET="dummy" |
79 | FL_LANE_EXPLORER_SECRET="dummy" | 90 | FL_LANE_EXPLORER_SECRET="dummy" |
80 | 91 | ||
@@ -112,6 +123,7 @@ if [ "$APP" != "app" ]; then | |||
112 | export POSTGRESQL_ADDON_USER="$FL_PSQL_USER" | 123 | export POSTGRESQL_ADDON_USER="$FL_PSQL_USER" |
113 | export POSTGRESQL_ADDON_PASSWORD="$FL_PSQL_PASSWORD" | 124 | export POSTGRESQL_ADDON_PASSWORD="$FL_PSQL_PASSWORD" |
114 | export POSTGRESQL_ADDON_DB="$name" | 125 | export POSTGRESQL_ADDON_DB="$name" |
126 | export PG_URI="postgresql://$POSTGRESQL_ADDON_USER:$POSTGRESQL_ADDON_PASSWORD@localhost:$POSTGRESQL_ADDON_PORT/$POSTGRESQL_ADDON_DB" | ||
115 | else | 127 | else |
116 | key=Psql/$(capitalize $FL_ENV)/$(capitalize $APP) | 128 | key=Psql/$(capitalize $FL_ENV)/$(capitalize $APP) |
117 | export POSTGRESQL_ADDON_HOST=$(p $key Host) | 129 | export POSTGRESQL_ADDON_HOST=$(p $key Host) |
@@ -119,7 +131,15 @@ if [ "$APP" != "app" ]; then | |||
119 | export POSTGRESQL_ADDON_USER=$(p $key User) | 131 | export POSTGRESQL_ADDON_USER=$(p $key User) |
120 | export POSTGRESQL_ADDON_PASSWORD=$(p $key) | 132 | export POSTGRESQL_ADDON_PASSWORD=$(p $key) |
121 | export POSTGRESQL_ADDON_DB=$(p $key Database) | 133 | export POSTGRESQL_ADDON_DB=$(p $key Database) |
134 | export PG_URI="postgresql://$POSTGRESQL_ADDON_USER:$POSTGRESQL_ADDON_PASSWORD@$POSTGRESQL_ADDON_HOST:$POSTGRESQL_ADDON_PORT/$POSTGRESQL_ADDON_DB" | ||
122 | fi | 135 | fi |
136 | |||
137 | export GRAYLOG_HOST="localhost" | ||
138 | export GRAYLOG_PORT="1111" | ||
139 | export ENVIRONMENT_NAME="local" | ||
140 | export APPLICATION_NAME="$APP" | ||
141 | export SENTRY_DSN="test" | ||
142 | export ACCEPTED_ORIGINS="*" | ||
123 | fi | 143 | fi |
124 | 144 | ||
125 | if [ "$APP" = "app" ]; then | 145 | if [ "$APP" = "app" ]; then |
@@ -140,6 +160,7 @@ if [ "$APP" = "app" ]; then | |||
140 | # carrier directory | 160 | # carrier directory |
141 | export CARRIER_DIRECTORY_URI="$FL_CARRIER_DIRECTORY_URL/" | 161 | export CARRIER_DIRECTORY_URI="$FL_CARRIER_DIRECTORY_URL/" |
142 | export FRETLINK_CARDIR_URL="$FL_CARRIER_DIRECTORY_URL" | 162 | export FRETLINK_CARDIR_URL="$FL_CARRIER_DIRECTORY_URL" |
163 | export FRETLINK_CARDIR_URL_FRONTEND="$FL_CARRIER_DIRECTORY_URL" | ||
143 | export FRETLINK_CARDIR_ENABLED="true" | 164 | export FRETLINK_CARDIR_ENABLED="true" |
144 | export FRETLINK_CARDIRV3_ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)" | 165 | export FRETLINK_CARDIRV3_ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)" |
145 | 166 | ||
@@ -160,6 +181,13 @@ if [ "$APP" = "app" ]; then | |||
160 | export FRETLINK_NOTIFIER_AMQP_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Rabbitmq/Local/Notifier subkey=Port') }}" | 181 | export FRETLINK_NOTIFIER_AMQP_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Rabbitmq/Local/Notifier subkey=Port') }}" |
161 | export FRETLINK_NOTIFIER_AMQP_VHOST="{{ lookup('passwordstore', 'Travail/Fretlink/Rabbitmq/Local/Notifier subkey=Vhost') }}" | 182 | export FRETLINK_NOTIFIER_AMQP_VHOST="{{ lookup('passwordstore', 'Travail/Fretlink/Rabbitmq/Local/Notifier subkey=Vhost') }}" |
162 | 183 | ||
184 | # pricer | ||
185 | export FRETLINK_PRICER_USE_CARGO_OUTPUT="true" | ||
186 | export FRETLINK_PRICER_SHIPPER_PRICE_V2_KEY=$(build_macaroon $FL_PRICER_SECRET pricer pricer pricing::cargo) | ||
187 | export FRETLINK_PRICER_SHIPPER_PRICE_KEY=$(build_macaroon --old $FL_PRICER_SECRET pricer pricer internal-cargo-pricing) | ||
188 | export FRETLINK_PRICER_CARRIER_SUGGESTION_KEY=$(build_macaroon --old $FL_PRICER_SECRET pricer pricer internal-cargo-pricing) | ||
189 | export FRETLINK_PRICER_MACAROON="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/PricerDev') }}" | ||
190 | export FRETLINK_PRICER_URL="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/PricerDev subkey=Url') }}" | ||
163 | 191 | ||
164 | # admin-root | 192 | # admin-root |
165 | export FRETLINK_ADMINROOT_URL=$FL_ADMIN_ROOT_URL | 193 | export FRETLINK_ADMINROOT_URL=$FL_ADMIN_ROOT_URL |
@@ -183,6 +211,24 @@ if [ "$APP" = "admin-root" ]; then | |||
183 | export LANE_EXPLORER_MACAROON_SECRET=$FL_LANE_EXPLORER_SECRET | 211 | export LANE_EXPLORER_MACAROON_SECRET=$FL_LANE_EXPLORER_SECRET |
184 | fi | 212 | fi |
185 | 213 | ||
214 | if [ "$APP" = "admin-user" ]; then | ||
215 | export BASE_URL=$FL_APPS_HOST | ||
216 | export API_ROOT="http://$BASE_URL:$PORT/api" | ||
217 | export UI_ROOT="http://$BASE_URL:$PORT/admin" | ||
218 | export ACCEPTED_ORIGINS="http://$BASE_URL:$PORT/admin" | ||
219 | export TOK="$(build_macaroon $FL_ADMIN_USER_PRIVATE_KEY admin-user admin-user admin-user::provisioning)" | ||
220 | export ADMIN_TOKEN="$(build_macaroon $FL_ADMIN_USER_SECRET admin-user admin-user admin-user::user-management)" | ||
221 | export SERVICE_TOKEN="$(build_macaroon $FL_ADMIN_USER_SECRET admin-user admin-user admin-user::some-service)" | ||
222 | fi | ||
223 | |||
224 | if [ "$APP" = "homepage" ]; then | ||
225 | export HOMEPAGE_API_KEY="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/HomepageDev subkey=ApiKey') }}" | ||
226 | export HOMEPAGE_API_ROOT_REDIRECT="https://next.www.fretlink.com" | ||
227 | export HOMEPAGE_API_BLOG_URL="https://blog.fretlink.com" | ||
228 | export HOMEPAGE_API_CIO_API_KEY="123" | ||
229 | export HOMEPAGE_API_CIO_SITE_ID="321" | ||
230 | fi | ||
231 | |||
186 | if [ "$APP" = "carrier-directory" ]; then | 232 | if [ "$APP" = "carrier-directory" ]; then |
187 | export ADMIN_BASE_URL=$FL_APP_URL | 233 | export ADMIN_BASE_URL=$FL_APP_URL |
188 | export ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)" | 234 | export ACCESS_KEY="$(build_macaroon $FL_CARRIER_DIRECTORY_SECRET carrier-directory carrier-directory carrier-directory::read)" |
@@ -194,7 +240,7 @@ if [ "$APP" = "notifier" ]; then | |||
194 | export TEMPLATES_ASSETS_BASE_URL="http://dummy/" | 240 | export TEMPLATES_ASSETS_BASE_URL="http://dummy/" |
195 | export TRANSPOREON_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/ApiTest subkey=Login') }}" | 241 | export TRANSPOREON_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/ApiTest subkey=Login') }}" |
196 | export TRANSPOREON_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/ApiTest') }}" | 242 | export TRANSPOREON_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/ApiTest') }}" |
197 | export TRANSPOREON_HOST="api.test.transporeon.com" | 243 | export TRANSPOREON_HOST="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/ApiTest subkey=Host') }}" |
198 | export TRANSPOREON_CALLBACK_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest subkey=Login') }}" | 244 | export TRANSPOREON_CALLBACK_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest subkey=Login') }}" |
199 | export TRANSPOREON_CALLBACK_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest') }}" | 245 | export TRANSPOREON_CALLBACK_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest') }}" |
200 | 246 | ||
@@ -203,6 +249,7 @@ if [ "$APP" = "notifier" ]; then | |||
203 | #export MACAROON="$(build_macaroon $FL_NOTIFIER_SECRET notifier notifier external)" | 249 | #export MACAROON="$(build_macaroon $FL_NOTIFIER_SECRET notifier notifier external)" |
204 | # v1 | 250 | # v1 |
205 | export MACAROON="$(build_macaroon --old $FL_NOTIFIER_PRIVATE_KEY notifier notifier external)" | 251 | export MACAROON="$(build_macaroon --old $FL_NOTIFIER_PRIVATE_KEY notifier notifier external)" |
252 | export MONITORING_MACAROON="$(build_macaroon --old $FL_NOTIFIER_PRIVATE_KEY notifier notifier monitoring)" | ||
206 | 253 | ||
207 | # To push transporeon cargos to app | 254 | # To push transporeon cargos to app |
208 | export TRANSPOREON_APP_PUSH_URL="http://localhost:8080/api/transporeon/cargo" | 255 | export TRANSPOREON_APP_PUSH_URL="http://localhost:8080/api/transporeon/cargo" |
@@ -217,6 +264,17 @@ if [ "$APP" = "notifier" ]; then | |||
217 | export AMQP_TLS="false" | 264 | export AMQP_TLS="false" |
218 | fi | 265 | fi |
219 | 266 | ||
267 | if [ "$APP" = "third-parties" ]; then | ||
268 | export PROCTER_GAMBLE_APP_PUSH_MACAROON="$(build_macaroon $FL_APP_SECRET third-parties app app::proctergamble-cargos-write)" | ||
269 | export PROCTER_GAMBLE_APP_PUSH_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_APP_PORT/api/proctergamble/cargo" | ||
270 | export TRANSPOREON_APP_PUSH_MACAROON="$(build_macaroon $FL_APP_SECRET third-parties app app::transporeon-cargos-write)" | ||
271 | export TRANSPOREON_APP_PUSH_URL="$FL_APPS_SCHEME://$FL_APPS_HOST:$FL_APP_PORT/api/transporeon/cargo" | ||
272 | export PROCTER_GAMBLE_CALLBACK_USER="{{ lookup('passwordstore', 'Travail/Fretlink/ProcterGamble/NotifierCallbackTest subkey=Login') }}" | ||
273 | export PROCTER_GAMBLE_CALLBACK_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/ProcterGamble/NotifierCallbackTest') }}" | ||
274 | export TRANSPOREON_CALLBACK_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest subkey=Login') }}" | ||
275 | export TRANSPOREON_CALLBACK_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Transporeon/NotifierCallbackTest') }}" | ||
276 | fi | ||
277 | |||
220 | if [ "$APP" = "pricer" ]; then | 278 | if [ "$APP" = "pricer" ]; then |
221 | export GOOGLE_AUTH_CLIENT_ID="dummy" | 279 | export GOOGLE_AUTH_CLIENT_ID="dummy" |
222 | fi | 280 | fi |