btw, I've deployed appsync service (this had the i...
# help
a
btw, I've deployed appsync service (this had the issue with custom domain plugin cause of
sls package
), and I've used buildspec instead of post deploy phase like below:
Copy code
after_deploy:
  - if [ $SEED_SERVICE_NAME = "cognito" ]; then cd /tmp/seed/source/services/appsync && yarn && sls deploy; fi
f
Hey @Anatol, you still need to install the plugins.
a
oh I see..
f
Sorry for the confusion, it really meant that Seed works well with most of the sls plugins out of the box.
a
with mono repo including multiple services, this brings some disadvantage for the build time..
f
The plugins are normally included in the
devDependencies
, they should get installed with npm/yarn install.
a
it seems build machine is not shared between multiple services of mono repo, so every service deployment phase is reinstalling root
package.json
again and again..
could you review this build log pls?
f
yup.. let me take a look
a
it's taking 3 mins almost.. very slow
as you can see here, I have 3 services of monorepo, each service deployment is taking 2 mins around because each one is installing root
package.json
again and again... no way to share one build server across multiple services? if we can do it, it will optimize the whole build time a lot..
one hack I can think is to define only one deployment phase for entire app and run deployment commands using build spec in it. but again I will loose the benefits for monitoring the deployment status of every service or orchestrating the deployment order or group between services..
f
Just had a look at the build log.
So normally, Seed caches the
node_modules
automatically, and will restore the cache.
a
yeah, but it's installing modules again from fresh, and taking 53 secs
f
If you expand the
INFO: Restoring dependency cache...
line, you’ll see the cache wasn’t found.
There are a couple of cases where the cache doesn’t get used, ie. yarn.lock is changed, force deployed, etc
a
hmm I see
what about sharing build server between multiple services of mono repo?
f
Yeah, each service is built inside it’s own standalone container. That will allow you deploy services in a highly parallel manner.
But I see your point, since you are structuring the 3 services sequentially.
I’m hoping if you make often changes to ur
package.json
and if you don’t force deploy,
yarn
should finish in a few seconds with cache present.
a
yeah right, they are dependent precedence services
hmm I see..
f
Oh also, periodically Seed adds new SLS versions to its cache.
a
so every build machine is installing serverless framework, and then looking for root
package.json
and install all dependencies and devDependencies in force for every service?
f
We haven’t added v2.60.0 to our cache, that’s why you are seeing ~20s for installing sls
That time will go down to 0s once we update our cache.
a
ahh I see..
f
Let me get the team have that updated asap.
I will keep you posted on it!
a
Thanks
btw, if I've enabled
check_code_change: true
in
seed.yml
, I can't integrate the deployment of implicit service in another service as I did currently
right?
f
Yeah so with node_modules cache and sls cached, you should save 1 min per service.
a
got it.
f
Yeah, that’s a downside of the
after_deploy
approach.
a
currently, I am deploying appsync service from cognito service deployment phase through buildspec: after_deploy commands
f
Oh but I guess you can use the dummy service approach.
a
ahh I see
yeah post deploy phase is somewhat not good way for me since I can't have source for it.
f
for example:
Copy code
/
  services/
    appsync/
      serverless.yml <- fake service
      real/
        serverless.yml <- real service
a
hmm could you elaborate this approach pls?
f
So you add the fake service to Seed, and in it’s
after_deploy
phase,
cd services/appsync/real && sls deploy
so you’d still have 4 services on Seed
a
ahh I see..
Thanks for your quick help always Frank
I will give it a try and post my questions if having any troubles
f
Sounds good!
a
@Frank could you check this build log?
in original appsync service directory, I placed serverless.yml with empty content and renamed appsync to appsync-real
but it's not working
mocking appsync's serverless.yml should be valid service?
f
Can I see your what’s in ur
services/appsync
?
a
nothing, just it includes serverless.yml with empty contents
mock service should have valid serverless.yml?
f
hmm.. it seems Seed wasn’t able to find
services/appsync/serverless.yml
a
yeah it's strange..
repo includes empty
services/appsync/serverless.yml
f
is the file completely empty?
a
yeah empty
it needs to be valid
serverless.yml
?
because I don't want to create CF stack for this mock service..
f
Git might not even track empty file.. it needs to be a valid
serverless.yml
with empty
functions
and
resources
a
hmm I see
let me try again
Copy code
service: appsync

frameworkVersion: "2"

disabledDeprecations:
  - CLI_OPTIONS_SCHEMA
  - NEW_VARIABLES_RESOLVER

provider:
  name: aws
  profile: havona
  runtime: nodejs14.x
  region: ap-southeast-1
  stage: dev
this is updated
sls.yml
f
service: appsync-fake
makes more sense?
u want to call the real one
service: appsync
a
hmm yeah
yup
so in this way, seed.run will deploy a fake service actually to AWS. right?
another issue I've got from last deployment was seed.run deployed services not changed even..
I didn't change any code or serverless.yml for other services except appsync, but seed.run re-deployed all of them even though I've enabled checking code change option:
check_code_change: true
Yay, this approach worked successfully now!
just one issue is the check code change config didn't work. I want to deploy only changed services upon every git commit
how could this make it working with seed @Frank?
can you check this pls?
it's not getting right AWS profile as my
serverless.yml
is using
profile: havona
but I still need to specify this profile in source code.
f
@Anatol I’m currently afk.. will take a look in a bit
a
@Frank can you help with this pls?
sure thing when you are available, please have a look at this and let me get your answer. Thanks
happy weekend 🙂
any update @Frank?
hey @Frank
hey @Frank @Jay can you help me with this issue pls?
I think this will be a quick fix for you guys, I love to stick with seed.run but I don't want to switch to another platform cause of this small glitch...
please help me @Frank @Jay
f
Hey @Anatol I will take a look at this in just a bit. Away from my keyboard at the moment.
a
oh got it, Thanks @Frank Looking forward to getting your solution to this issue right soon as I can't wait any more.. my client is chasing me with this issue some days.
Thanks
f
Hey @Anatol, just got back. Taking a look.
In stead of:
Copy code
if [ $SEED_SERVICE_NAME = "appsync" ]; then cd /tmp/seed/source/services/appsync && yarn && sls deploy; fi
try:
Copy code
if [ $SEED_SERVICE_NAME = "appsync" ]; then cd /tmp/seed/source/services/appsync && sed -i '' '/profile: default/d' serverless.yml && yarn && sls deploy; fi
change
default
to the profile in the
serverless.yml
Essentially, this removes the profile in
serverless.yml
before deploying. And your IAM credentials will be used.
Let me know if it works for you!
a
Ahh, Thanks so much @Frank I think this will work for me.. Awesome!
Hey @Frank I've followed your instructions but I am getting error like below:
Copy code
check_code_change: true
after_deploy:
  - "if [ $SEED_SERVICE_NAME = 'appsync' ]; then cd /tmp/seed/source/services/appsync && sed -i '' '/profile: havona/d' serverless.yml && yarn && sls deploy; fi"
this is my seed.yml
f
let me give it a try
a
Thanks
as you can see here, I have
serverless.yml
in
services/appsync
directory
also here is appsync's
serverless.yml
f
Instead of:
Copy code
sed -i '' '/profile: havona/d' serverless.yml
Can you give this a try:
Copy code
sed -i 's/profile: havona//g' serverless.yml
The sed command works differently on different OS. The latter should work on Ubuntu (build server OS)
a
got it
Copy code
's/profile: havona//g'
this is true?
f
-i
means replace in line
s/profile: havona//g
means search and replace with empty string
a
double slash before
g
f
yeah it will replace
profile: havona
with empty string (nothing within the slashs)
a
got it
now trying another build
Greaet this time, it worked. Thanks a lot @Frank
👍
f
Oh nice! Glad it’s working!