Closed adolski closed 1 year ago
I got close to deploying to demo, but got the following error message after running rails-container-scripts/redeploy.sh demo
:
@gaurijo Do you know if you have push access to ECR? I wonder if you are still (or ever were) using our read-only AWS account.
This might also be a question for @genschmitt.
Ahh, maybe that's it. When I log into our AWS console, it appears I do still only have read-only access:
@gaurijo @adolski I have reached out to Jason, he set up Gauri's account and should be able to give her full permissions on the medusa account
@gaurijo @adolski Gauri should have admin permissions now, let me know if there are any issues
Thanks @genschmitt!
@genschmitt Thank you! Confirming I now have admin permissions.
@adolski Unfortunately, I am still seeing the same 401 Unauthorized error when attempting to deploy to demo. Is there a way to point the aws login
cli to my admin account, assuming that's why I'm still getting that error? When re-running aws login
, I just get a prompt 'Already logged in'.
You can log out with aws logout
:smile:
Next time you aws login
you'll get a prompt like this where you should choose (1):
Account: 721945215539
[ 1 ]: MedusaAdmins
[ 2 ]: Read-Only
A great example of overthinking things 😆 Thank you!
Unfortunately I'm still getting the same 401 unauthorized error
when trying to deploy, even after choosing MedusaAdmins
at aws login
.
I was looking at the push commands associated with the demo version; Is it possible I'm running into this error because I need to authenticate my Docker to ECR?
I think you're right!
I've just added the ECR login command into rails-container-scripts/docker-build.sh
. I guess it isn't possible to build & push separately with docker buildx
, but that should be OK.
Great. I think demo has been deployed now -- I see that the image was pushed on the AWS console. However I did get this aws error message after deployment:
redeploy.sh
is a shortcut that invokes docker-build.sh
and then ecs-deploy-webapp.sh
. By inspecting those you can find a --cluster
argument in ecs-deploy-webapp.sh
where $ECS_CLUSTER
is apparently not set. Did you copy the env-common.list
file from Box into your rails-container-scripts
?
That's what was even more confusing because I have the $ECS_CLUSTER
var set in the env-common.list
that was copied over from box:
ECS_CLUSTER=book-tracker
OK, well... did you try to argue with it?
(sorry, had to do it)
Maybe this error doesn't have anything to do with the argument, and maybe your account is limited in some way that would prevent the aws
CLI from having access to the book-tracker
ECS cluster.
What do you get when you run aws ecs update-service --cluster book-tracker --service book-tracker-demo-service
?
I'd definitely lose that argument 😆
When I run that command, it's saying the security token is expired -
When you get that, you have to aws login
again.
Got it. After logging back in as admin and running that command I get a very long output:
{
"service": {
"serviceArn": "arn:aws:ecs:us-east-2:721945215539:service/book-tracker/book-tracker-demo-service",
"serviceName": "book-tracker-demo-service",
"clusterArn": "arn:aws:ecs:us-east-2:721945215539:cluster/book-tracker",
"loadBalancers": [
{
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5",
"containerName": "book-tracker-demo-shib-frontend",
"containerPort": 443
}
],
"serviceRegistries": [],
"status": "ACTIVE",
"desiredCount": 1,
"runningCount": 0,
"pendingCount": 1,
"launchType": "FARGATE",
"platformVersion": "1.4.0",
"platformFamily": "Linux",
"taskDefinition": "arn:aws:ecs:us-east-2:721945215539:task-definition/demo-book-tracker-td:13",
"deploymentConfiguration": {
"deploymentCircuitBreaker": {
"enable": false,
"rollback": false
},
"maximumPercent": 200,
"minimumHealthyPercent": 100
},
"deployments": [
{
"id": "ecs-svc/2889045813749197357",
"status": "PRIMARY",
"taskDefinition": "arn:aws:ecs:us-east-2:721945215539:task-definition/demo-book-tracker-td:13",
"desiredCount": 1,
"pendingCount": 1,
"runningCount": 0,
"failedTasks": 0,
"createdAt": 1695762844.643,
"updatedAt": 1695921552.831,
"launchType": "FARGATE",
"platformVersion": "1.4.0",
"platformFamily": "Linux",
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
"subnet-0fb6204621433d0e7"
],
"securityGroups": [
"sg-08fc90763d091abe3"
],
"assignPublicIp": "DISABLED"
}
},
"rolloutState": "COMPLETED",
"rolloutStateReason": "ECS deployment ecs-svc/2889045813749197357 completed."
}
],
"roleArn": "arn:aws:iam::721945215539:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
"events": [
{
"id": "16166876-3630-4367-8377-bb082cc4d888",
"createdAt": 1695923873.107,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task ff09753d0a6a4adb9d189fd13de5ecc5)."
},
{
"id": "ad64790e-6411-4cac-bf5d-4cd0131544ef",
"createdAt": 1695923679.14,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "ab128ed3-33a5-4297-b2bf-9ead7b2f697f",
"createdAt": 1695923679.135,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "46f73747-eb06-4e81-94c3-72fbd227df80",
"createdAt": 1695923659.603,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "04fd82b4-9fc4-451a-a2e3-b849bf7dcf3f",
"createdAt": 1695923566.875,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task d9bcd84884834a22b17b1cadb90505be)."
},
{
"id": "fc92b6d6-58fd-4d35-a0d9-3117cbc25994",
"createdAt": 1695923557.511,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "d4e04f60-28f0-49e1-94d6-b406621cf850",
"createdAt": 1695923557.504,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "76558968-6c0c-4a86-904a-321053fa064e",
"createdAt": 1695923537.47,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "fce5f758-25d4-486d-bed1-42dc8f573040",
"createdAt": 1695923440.288,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 17e82de45fde4be9bc6412d976d234f7)."
},
{
"id": "9b3a7f5d-444a-4b34-be11-03a8441c9b9b",
"createdAt": 1695923252.899,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "f6d00afc-58a2-4ba7-a514-d1dd8e497829",
"createdAt": 1695923252.895,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "aa61fb23-8d92-4db4-8079-1e7560b28e79",
"createdAt": 1695923224.482,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "9056e6d7-d69d-4b9a-8114-8eaeff61363b",
"createdAt": 1695923129.813,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task fdc400d3466e444ab9cce52b82f6fb2d)."
},
{
"id": "67b9313e-4322-4430-9d20-20434d8710d1",
"createdAt": 1695923119.185,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "cd5232b4-b783-43af-b2ce-86f8bceca13d",
"createdAt": 1695923119.177,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "4afbf89f-e58c-4324-a416-927fc8e84f2e",
"createdAt": 1695923090.811,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "2f2b74c5-c953-4b05-88f5-d34235b1ce8e",
"createdAt": 1695922994.925,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 41f96f8879cc458392b2eb54d2cb8f0d)."
},
{
"id": "946f9039-29b8-4b7a-bfeb-a4c39d77fcdf",
"createdAt": 1695922814.141,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "2974571e-ad85-4f05-a51f-01a7f94c1170",
"createdAt": 1695922814.135,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "eeec1afb-e28c-42b5-9822-d1e751caf355",
"createdAt": 1695922784.948,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "0f273bb1-8313-472f-a926-daf48d2e2b5a",
"createdAt": 1695922690.505,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task b999ebf407b84bff93be4988f8e44800)."
},
{
"id": "2d77fb5e-0728-4a6d-b277-9f738b16aedb",
"createdAt": 1695922671.262,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "d9c6993b-50ec-48a2-b88d-45f5bc3c3be7",
"createdAt": 1695922671.258,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "fffebbf8-efcc-4fad-aa57-d04b6d1f6938",
"createdAt": 1695922643.204,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "5342f903-8988-414e-9a44-39bc97c0cb8d",
"createdAt": 1695922548.987,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task b0313ecfff07497b8681c1c39163a4fc)."
},
{
"id": "edb1b6c7-23d9-4215-8a2e-b2467ae3c145",
"createdAt": 1695922375.348,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "66c3eba4-1a72-4e36-9ea6-37e17526fd40",
"createdAt": 1695922375.344,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "4cd41954-c901-4dba-8479-f4a10a7349f0",
"createdAt": 1695922355.791,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "15f6c318-d1ad-4265-9e1a-c2f55ac51b61",
"createdAt": 1695922261.344,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 5a30d84d2d8a446883b8e04dc5d4fb35)."
},
{
"id": "82549cd0-fd85-4188-bd8e-caa72cf18bd5",
"createdAt": 1695922231.68,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "270d8662-dd1e-40b4-9fb3-b32e5cc4a66d",
"createdAt": 1695922231.676,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "5db33eca-0815-40a8-b8cf-cf29e6fe717f",
"createdAt": 1695922211.552,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "dd53d82e-be23-452c-88db-b966826e145e",
"createdAt": 1695922114.5,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 80a23caaf3cc4be99092ca77a6d1d9c6)."
},
{
"id": "b744d6fc-568a-4060-b7b0-554697d08071",
"createdAt": 1695921940.819,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "bb600ce5-c9fc-4932-b521-da9e20212e93",
"createdAt": 1695921940.815,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "19461755-f1a2-4374-9cff-56d8b2362027",
"createdAt": 1695921912.104,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "3410414e-d3a9-4abc-a8a5-7e85b0e6b73f",
"createdAt": 1695921823.886,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 482d480ea6f54572ac4467d461acbda4)."
},
{
"id": "8ecb8e4d-eee1-4cec-bbb1-03387aec2847",
"createdAt": 1695921795.751,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "b3be900d-98b9-4a3d-a498-af636354c758",
"createdAt": 1695921795.747,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "bafe5aaf-0908-46bd-8229-e7f9eaa3337c",
"createdAt": 1695921766.153,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "9a1f9a39-80e7-4aed-a6d9-f5a7c9953a91",
"createdAt": 1695921670.703,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 52ac248009aa428fb87cb70a1364f07d)."
},
{
"id": "169ff32c-ab24-4511-a4c2-87f59cfe72f4",
"createdAt": 1695921512.201,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "9048e0f1-8919-4afd-88d3-5aa22d04d2af",
"createdAt": 1695921512.196,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "835d41a5-3674-46ea-8073-b24fa0a0a4bd",
"createdAt": 1695921492.805,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "3c9ba384-a81a-4b55-b4e1-2b719e7a793a",
"createdAt": 1695921397.046,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task ae2732f085954209a33972dfb6970c55)."
},
{
"id": "2e7ffe08-a6ad-48c4-bd2c-86b88d2d2c06",
"createdAt": 1695921358.567,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "d3ba10c1-503e-430f-b8c5-5244ed2284c8",
"createdAt": 1695921358.559,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "449f4adf-f4c7-465e-8723-27248fe17cc1",
"createdAt": 1695921329.355,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "e27e4d69-d62b-4caf-83b7-dc28a69947d3",
"createdAt": 1695921233.797,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 1afd1af6d092429798314267d7a98769)."
},
{
"id": "f7bbb5d0-916f-457d-ab32-953295b86e00",
"createdAt": 1695921078.906,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "20da720f-5ee3-43ff-a4b1-e27301e5913a",
"createdAt": 1695921078.901,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "d67af96a-2a7c-471e-9e13-c6ef36416911",
"createdAt": 1695921051.611,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "3db36ae4-fabd-49c5-a5b0-45c3962c0d72",
"createdAt": 1695920955.63,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task baa48953baa24b3ebf1ad8439fe35ab5)."
},
{
"id": "4e5bf772-1355-4815-ab68-4af04935aba6",
"createdAt": 1695920915.295,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "6783e070-d12f-4764-bf74-ac22db1c2fc3",
"createdAt": 1695920915.289,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "93600c13-df63-4a31-9d2f-619998d709b1",
"createdAt": 1695920886.137,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "83c47b99-5ebc-4022-8d47-e627cbd79468",
"createdAt": 1695920791.206,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task ffe3dd8377c547188486d65bfac16601)."
},
{
"id": "66531f9a-f41b-4447-baea-682771f7d3b4",
"createdAt": 1695920637.769,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "e514504a-f88d-4684-bee1-4ca3dbb3bcbd",
"createdAt": 1695920637.765,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "a04f53ce-ef3f-4f48-ab53-6fab7fa2bfcf",
"createdAt": 1695920619.286,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "9625e304-50c8-4096-8dfa-ee5a2220424e",
"createdAt": 1695920521.256,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 401249b334f04621b8e07ee66e8357a2)."
},
{
"id": "34f4471c-be1e-46b1-8b95-d0d134620c8f",
"createdAt": 1695920473.446,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "f47a78a6-df2a-418b-97ee-fd7bc59d66bf",
"createdAt": 1695920473.441,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "6b8cf2ca-ed51-4b9c-96ff-46f5c956b9ad",
"createdAt": 1695920445.385,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "843d0e56-edb2-4262-9acc-692aea98458a",
"createdAt": 1695920347.759,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 7c4eaeda9625443ca0d04bd3a82a8f78)."
},
{
"id": "afe70ba4-7652-4d47-8976-72a6296282a2",
"createdAt": 1695920195.026,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "4be437d8-88d3-4adb-9cc8-b9f4c905aec6",
"createdAt": 1695920195.022,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "dca0774b-f8f7-440f-8ec3-7fe185b29740",
"createdAt": 1695920166.161,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "47f60c28-6519-43ff-8071-607864a1e01b",
"createdAt": 1695920078.705,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 3d3b3c13523044bdb35589edf0887486)."
},
{
"id": "b41f34f3-71bd-475f-8c4f-b804eb95b8aa",
"createdAt": 1695920030.276,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "29a723fe-5a4f-4607-ba1b-2dd23340e1b2",
"createdAt": 1695920030.271,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "7cea1894-66b8-4c58-b8d0-7150b672a564",
"createdAt": 1695920001.055,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "37b4c346-426e-46ab-a8e2-d6fc5bd83c0a",
"createdAt": 1695919906.076,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 830f40c264a34436855fe1f6304bd873)."
},
{
"id": "08577861-30da-4c98-8daa-22b124787e8c",
"createdAt": 1695919762.593,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "f2cd2efb-bfcc-42dd-b353-ac1a850a40d8",
"createdAt": 1695919762.59,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "05dc3435-eb2e-40eb-bd39-ba15073faa98",
"createdAt": 1695919734.736,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "b10bf6bf-0af5-449e-8115-d7883a2aac94",
"createdAt": 1695919637.845,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task dcef09fadc8b42c3bfa0965a8b12bbcf)."
},
{
"id": "d0e75bc7-355f-4214-bafc-f15cea0f2a1b",
"createdAt": 1695919589.67,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "a5fb7232-7d02-4af1-ad04-946c9b275b02",
"createdAt": 1695919589.666,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "0a1771f1-6620-40cb-9b62-4a1052999415",
"createdAt": 1695919561.785,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "d323279a-b037-413d-a0df-73c805384b58",
"createdAt": 1695919464.563,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task b187ca23425c4c1c8dc85c486abe23b6)."
},
{
"id": "788d3e4d-8f62-4763-b4cc-ddc5a4530e7c",
"createdAt": 1695919326.086,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "14380a04-d4c3-446e-9c39-1773441e1f10",
"createdAt": 1695919326.082,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "9e7d2198-a814-4ce4-80c0-0126b9e11134",
"createdAt": 1695919296.442,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "66f97668-ca18-421d-864b-ccea77e55e13",
"createdAt": 1695919199.704,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task f19f45399370434984c1eb327eef7b5c)."
},
{
"id": "e71eb32b-398f-4d86-a1bd-979c9629c800",
"createdAt": 1695919153.042,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "a43608f4-2573-492c-a1a7-1be3b2120890",
"createdAt": 1695919153.037,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "615091e5-6110-4ccb-86d3-d8019bb0ae41",
"createdAt": 1695919132.684,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "030d9fc3-af21-4ddf-8816-3692aa9d8e1b",
"createdAt": 1695919039.188,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task c1ee3128581b458d8b4fa29fb4a418df)."
},
{
"id": "f0358b11-f074-4a2d-9722-a9fa8feab4d4",
"createdAt": 1695918885.837,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "8af80e92-aab7-4820-b1f3-caa3dc680de7",
"createdAt": 1695918885.834,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "9d26b2e0-7c24-4ecc-8283-a538ea6eb825",
"createdAt": 1695918858.52,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "49b8df51-2696-482a-987c-d5031874b21f",
"createdAt": 1695918765.402,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 9bca657b92b54e6fb93e0be42fdcd357)."
},
{
"id": "562aed16-9afb-440e-aa55-6ef8a4e83784",
"createdAt": 1695918714.176,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "e9c8926c-fa2a-482e-a375-80ae1f47f3ca",
"createdAt": 1695918714.172,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "48e54d87-5f4c-4d16-8f76-5927bdb6e2a1",
"createdAt": 1695918684.955,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "a0f34740-6d52-45fc-ad02-14db6edbca94",
"createdAt": 1695918588.251,
"message": "(service book-tracker-demo-service) has started 1 tasks: (task 80ea1a45020a435590f18a4475ca74bb)."
},
{
"id": "ce9cc75c-2268-4638-bced-f6d8bd7435d5",
"createdAt": 1695918453.508,
"message": "(service book-tracker-demo-service, taskSet ecs-svc/2889045813749197357) has begun draining connections on 1 tasks."
},
{
"id": "7e953d6c-9996-41ae-9d6e-e1ec0be4eeac",
"createdAt": 1695918453.504,
"message": "(service book-tracker-demo-service) deregistered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
},
{
"id": "c4a212b7-3cd6-4048-8a64-dca480784ce2",
"createdAt": 1695918424.076,
"message": "(service book-tracker-demo-service) registered 1 targets in (target-group arn:aws:elasticloadbalancing:us-east-2:721945215539:targetgroup/book-tracker-demo-shib-tg/604998ef95e8ede5)"
}
],
"createdAt": 1561487249.38,
"placementConstraints": [],
"placementStrategy": [],
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
"subnet-0fb6204621433d0e7"
],
"securityGroups": [
"sg-08fc90763d091abe3"
],
"assignPublicIp": "DISABLED"
}
},
"healthCheckGracePeriodSeconds": 60,
"schedulingStrategy": "REPLICA",
"deploymentController": {
"type": "ECS"
},
"createdBy": "arn:aws:iam::721945215539:role/MedusaAdmins",
"enableECSManagedTags": false,
"propagateTags": "SERVICE",
"enableExecuteCommand": false
}
}
That is the message that ECS has accepted the deploy request. It takes a few minutes for ECS to swap in the new container for the old one.
Unfortunately https://demo.book-tracker.library.illinois.edu is returning HTTP 503. This usually means that ECS tried to spin up the new container but failed, which means some kind of error from the container.
To investigate, you can:
book-tracker
clusterbook-tracker-demo-service
serviceHere you can see that something is wrong, where it says, "deployments in current state: 2 failed, 1 in progress". When a container exits, ECS automatically tries to start a new one, over and over again.
In order to know what specifically is wrong, we want to see the log output from the container. Unfortunately the AWS web UI for log viewing is really horrible. You have to:
demo-book-tracker
And here is what the container logged:
=> Booting Puma
=> Rails 7.0.2.4 application starting in demo
=> Run `bin/rails server --help` for more startup options
Exiting
/app/config/initializers/uiuc_lib_ad.rb:8:in `<top (required)>': undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:667:in `load'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:667:in `block in load_config_initializer'
from /usr/local/bundle/gems/activesupport-7.0.2.4/lib/active_support/notifications.rb:208:in `instrument'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:666:in `load_config_initializer'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:619:in `each'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/engine.rb:619:in `block in <class:Engine>'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:32:in `instance_exec'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:32:in `run'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/local/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
from /usr/local/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /usr/local/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:50:in `each'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:50:in `tsort_each_child'
from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `call'
from /usr/local/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each'
from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `call'
from /usr/local/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/local/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
from /usr/local/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/initializable.rb:60:in `run_initializers'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/application.rb:372:in `initialize!'
from /app/config/environment.rb:5:in `<top (required)>'
from config.ru:3:in `require_relative'
from config.ru:3:in `block in <main>'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:349:in `build_app_and_options_from_config'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:249:in `app'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:422:in `wrapped_app'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:312:in `block in start'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:379:in `handle_profiling'
from /usr/local/bundle/gems/rack-2.2.8/lib/rack/server.rb:311:in `start'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:38:in `start'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'
from <internal:kernel>:90:in `tap'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/commands/server/server_command.rb:134:in `perform'
from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/command/base.rb:87:in `perform'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/command.rb:48:in `invoke'
from /usr/local/bundle/gems/railties-7.0.2.4/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Thanks for explaining how to access the logs here.
I notice that this error: /app/config/initializers/uiuc_lib_ad.rb:8:in <top (required)>: undefined method [] for nil:NilClass (NoMethodError)
is pointing to the set up of a new configuration instance, particularly for the user. I'm wondering if this is means I'm not a recognized user and/or something to do with my permissions. Especially since you mentioned you were able to push to demo earlier.
uiuc_lib_ad
is a gem we use to look up user info in the U of I Active Directory (AD). "[] for nil:NilClass" means that app_config.ad
is nil which means that there is no app configuration which means that something is messed up.
When I pushed to demo, I was pushing different code, based on the develop
and demo
branches.
Aside from this, does the web app appear to work locally and do all tests pass?
The tests are passing (aside from the two tests for User model, which was expected).
Edited to Add: I'm able to access the web app locally when I open a new browser window, but when I try it in an already open browser I'm getting the below error
Are you using http://localhost:3000 or https://localhost:3000? (The first is correct)
I'm using http://localhost:3000
When I try it in the chrome browser that is associated with my U of I account (orange color window on left), it won't load. However I when stop the server and then re-run it and open it in my personal chrome browser (teal color window on right), it works just fine 🤔
You have two different Chrome browsers open at the same time, or two windows of the same running Chrome? By "associated with your U of I account," do you mean logged in via Shibboleth? Does the orange one have an extension like HTTPS Everywhere loaded?
I have two different profiles of the same running Chrome, one of which I'm logged in via Shibboleth. I don't believe I have any kind of HTTPS everywhere extension on either of them
This is interesting - when I look at the source code, it's showing that the failed url is https://localhost:3000 (and same with the 'reload' button redirect), even though I'm entering http://
each time. I tried clearing my browser history but it didn't do anything. I'm going to continue looking into why this is happening, but sharing here in case you notice anything I missed.
@adolski Back to the logs on AWS Cloudwatch
and why this error is occurring when trying to deploy: /app/config/initializers/uiuc_lib_ad.rb:8:in <top (required)>: undefined method [] for nil:NilClass (NoMethodError)
I'm thinking the issue is I don't have any of the Active Directory
credentials set up in my development.yml
file.
Since that's what the uiuc_lib_ad gem
is looking for when trying to configure the app, and when I $ rails console
into the app, I see that all of those attributes are in fact 'nil'.
If this is the root problem, do you know how I could obtain those credentials and/or if I even have any?
Those credentials are only needed in demo and production and should be empty in all other environments. The ci.yml
file should contain a block like:
ad:
user:
password:
server:
treebase:
Which it does. The error suggests that the block isn't there... which, since it is there, suggests that the ci.yml
file isn't getting copied over test.yml
. (I bet your test.yml
does not contain the block.)
Gotcha. Looking at my test.yml
file, I do see the block there as well (also empty). Since the credentials are empty in development and testing environments, I'm a bit confused on where those credentials are supposed to be pulled from.
In config/initializers/uiuc_lib_ad.rb
, try wrapping the configuration assignment in a condition:
if app_config.ad
UiucLibAd::Configuration.instance = UiucLibAd::Configuration.new(
user: app_config.ad[:user],
password: app_config.ad[:password],
server: app_config.ad[:server],
treebase: app_config.ad[:treebase]
)
end
Adding the conditional seemed to take care of the nil class/no method
error!
Now I am seeing this in the AWS logs:
/usr/local/bundle/gems/railties-7.0.2.4/lib/rails/application.rb:580:in validate_secret_key_base: Missing secret_key_base for demo environment, set this string with bin/rails credentials:edit (ArgumentError)
After running bin/rails credentials:edit -e demo
I'm alerted to assign an Editor first. Using VScode that would probably look like EDITOR="code --wait" bin/rails credentials:edit -e demo
At this point would I just include something like:
demo:
secret_key_base: '<the string of numbers inside the demo.key file>'
Alright, this is my fault for suggesting running the demo/production container locally. I forgot that it has config.force_ssl = true
in app/config/environments/demo.rb
& production.rb
which auto-redirects all non-HTTPS requests to HTTPS. And, it wouldn't work anyway because it's configured to access the RDS databases in AWS which we can't access from our local computers.
So, I've pushed some changes to develop
:
Dockerfile
(no longer used)docker/book-tracker-app
to docker/book-tracker-aws
(to make it clearer that it will be used in demo & production)docker/book-tracker-development
With this setup I'm able to run the tests successfully:
docker compose -f docker-compose.test.yml -f docker-compose.yml up --build --exit-code-from book-tracker
and also the web app (in development mode):
docker compose up --build --exit-code-from book-tracker
We don't necessarily even need a development Docker image, but if we can get a development container running locally, then it is more likely that the demo & production containers will ultimately work.
From here, why don't you try deploying to demo again.
Should I still try deploying to demo from the demo branch
, or from the develop branch
to include the changes you pushed up?
Best practice would be to merge develop
into demo
and then deploy from demo
.
I'm still having trouble deploying to demo
. Here are the steps I took:
git checkout demo
-> git merge origin develop
uiuc_lib_ad.rb
config inside anif statement
as suggested earlierrails-container-scripts/redeploy.sh demo
script I kept getting an error saying it couldn't find the Dockerfile directory
. I then updated the docker-build.sh
file with the exact paths for each Dockerfile, and that solved that error:docker buildx build --platform linux/amd64,linux/arm64 --push \
-t $ECR_HOST/$IMAGE_NAME -f docker/book-tracker-aws/Dockerfile -f docker/book-tracker-development/Dockerfile -f docker/book-tracker-test/Dockerfile .
redeploy.sh demo
again and got this same error: aws: error: argument --cluster: expected one argument
CloudWatch
and found: Please check your database configuration to ensure the username/password are valid.
I'm not sure why I'm getting this error since I didn't change anything related to username/password at this point.
Could you pull the latest code on the demo
branch and try again?
I was just having problems building one of the images (I don't know why not before) so I updated the required Ruby version to 3.2.2, which appears to support the ARM Macs better. So you will also have to do rbenv install 3.2.2
and bundle install
.
After pulling the latest code on demo
branch and making sure I have the correct Ruby version installed, I'm still getting the same aws: error: argument --cluster: expected one argument
message, however when I check the AWS logs everything appears to be running correctly. I don't see any stopped containers/error messages in the logs.
I still don't know what the deal is with that cluster argument message. You are logged in via aws login
, right? And after the deploy command (rails-container-scripts/ecs-deploy-webapp.sh
) completes, it should output a bunch of JSON like it did here. If that didn't happen then the deploy failed and what's running at https://demo.book-tracker.illinois.edu is from a previous deploy.
Do you get the cluster argument error when you run:
aws ecs update-service \
--profile default \
--region us-east-2 \
--cluster book-tracker \
--service book-tracker-demo-service \
--task-definition demo-book-tracker-td \
--desired-count 1 \
--force-new-deployment
Yes, confirmed I'm logged in via aws login
After the deploy command completes, I did NOT see JSON output, it only shows if I re-run this command: aws ecs update-service --cluster book-tracker --service book-tracker-demo-service
However, when I run the entire block (aws ecs update-service \...)
you provided, I do not get a cluster argument error and I do see a bunch of JSON output.
Now when I look at the AWS logs I see this deploy failed and what it was showing earlier was a previous deploy.
I'm back to seeing an error message with my postgres db
:
There is an issue connecting to your database with your username/password, username: postgres. (ActiveRecord::DatabaseConnectionError)
When I run $brew services list
in my terminal I get the following output, showing an error with my postgres service.
Can you figure out why the --cluster
argument isn't working? I'm out of ideas on that front.
The error in the AWS log about connecting to the database is some other problem, but it's not related to your local postgres database. In demo & production, the Book Tracker connects to an AWS RDS instance, not your local instance.
Gotcha, thanks for clarifying re: postgres db.
I will keep digging around to figure out why the --cluster
argument keeps giving me trouble.
Alright, I believe I've figured out the culprit for the --cluster
error. I added a debugging line inside the ecs-deploy-webapp.sh
file to return the $ECS_CLUSTER
name upon deploying:
echo "ECS_CLUSTER: $ECS_CLUSTER"
After running the deploy script this output was coming up empty so I thought it might be a scoping issue with how the $ECS_CLUSTER
variable was being called inside the env-common.list.
I'm not entirely sure why, but moving the variable line up a few lines so it comes right after the $AWS_REGION
got things working. Now I no longer get the --cluster
error, and I get a long JSON output.
The AWS logs are just showing the earlier postgres db error I mentioned, but the cluster arg seems to be resolved now.
That's great that you were able to fix the --cluster
argument.
I'm not sure what is happening with the Docker build, and I'm also not sure about the best way to troubleshoot it. I think what I will do is make a fresh clone of the Book Tracker repo, set it all up, try to deploy, and document my steps, and then report back.
Sounds good. In the mean time I've been trying to see if I can get Book Tracker working on my Library IT macbook (I've made progress but currently stuck on a bundler issue).
Also - is it fine if I get started on getting tests working in GitHub Actions #4 or wait until I'm able to deploy?
You are welcome to try. I just posted another comment in that issue that may help.
Here is the full list of steps I went through to deploy a new clone of the Book Tracker. I think something is wrong in your clone, so you may be able to compare them, or you may want to just start over with a new clone.
# Clone the repo including submodules
git clone https://github.com/medusa-project/book-tracker.git --recurse-submodules
# Install gems
bundle
# Copy config/credentials/demo.key and production.key from the other clone
# Copy config/credentials/development.yml and test.yml from the other clone
# Copy rails-container-scripts/env-common.list, env-demo.list, and env-prod.list from the other clone
# Checkout the demo branch
git checkout demo
# Log into AWS
aws login
# Create whatever this is
docker buildx create --use
# Build & push the demo image
rails-container-scripts/docker-build.sh demo
# Tell ECS to spin up a new container
rails-container-scripts/ecs-deploy-webapp.sh demo
I think this is why I keep getting the postgres errors
when trying to deploy. When I run bundle
or bundle install
, I get the following error regarding the pg gem
:
When I look at the log, there are multiple errors about building for macOS-arm64 but attempting to link with file built for macOS-x86_64
. So it seems like there is some discrepancy between the architecture used for the app vs the machine I'm using? I got the same error on the Library IT macbook (Apple M2) when trying to set it up there.
I tried re-running with the suggested flags, and brew install libpq
but it's sending me in circles back to the same errors. Any ideas on how to handle this?
Could you run this command in the terminal and see if your output is the same:
% file $(which psql)
/opt/homebrew/bin/psql: Mach-O 64-bit executable arm64
Now that I have an ARM-based Mac, I've been able to figure out how to build an x86 Docker image with it, since that is still what the Book Tracker is using in ECS. (I assume we'll want to switch to ARM in production eventually, but that's a separate issue.)
In order to get a deploy working, here is what you'll have to do:
git submodule update --remote
)rails-container-scripts
directory from here: https://uofi.app.box.com/folder/221871628316git pull origin develop demo
to update the book tracker code (I made some other changes)docker buildx create --use
(only have to do this once ever, I think)At this point your environment should be set up for deploying. To do the deploy, you would do something like:
aws login
git checkout demo
rails-container-scripts/redeploy.sh demo
@gaurijo I've already done the deploy to demo on my end, but please try it yourself and let me know if you run into any problems. Once you've deployed to demo then it should be easy to deploy to production.