I have two environments for my Amplify backend and two branches Git Dev and Prod. Dev contains the Amplify environment Dev and Prod contains Prod. How can I update the (amplify) prod environment with dev content
git checkout dev
amplify env add dev
git checkout prod
amplify pull envName dev (error no dev env)
Related
i am trying to run pipeline on bitbucket, for my nodejs app, and i have some issue on deployment step (aws ec2). Pipeline runs in container, ssh-ing to my instance on aws, and then try to git clone my app, by command
git clone https://my_bitbucketusername:my_bitbuckettoken#bitbucket.org/somevendor/somerepo
but it is not good option to provide token in script, so i tried to set token as repository variable like $BITBUCKET_TOKEN,
git clone https://my_bitbucketusername:$BITBUCKET_TOKEN#bitbucket.org/somevendor/somerepo
but then i faced with bitbucket failed authentification. Same issue on gitlab, whad i do wrong?
I have 3 Instances in AWS one is dev, staging and build server instance. If I build staging branch in build server. How can I copy the repo to another EC2 instance such staging server from build server?
How to generate ".env" when Deploying with Bitbucket AWS CodeDeploy add-on?
I see bitbucket-pipelines.yml can generate .env from bitbucket environment variables, but, how tie it up with Bitbucket AWS CodeDeploy add-on?
appspec.yml - can trigger script on deployment but how can I make it get .env from bitbucket environment variables?
BitBucket should not create .env, this service should know nothing about production .env. Instead the production .env should sit on secure AWS S3 bucket where only AWS CodeDeploy scripts can take it and put on the instance.
it would be copied like this
sudo aws --region us-east-2 s3 cp "s3://${S3_NAME}/prod.env" "${EC2_DIRECTORY}/.env"
Looking at the documentation, BitBucket should make the environments available in the build environment, and you should be able to access them directly in your scripts run by your appspec.yml just like you would access any other environment variables.
For example, if we had an appspec like this:
hooks:
AfterInstall:
- location: scripts/runTests.sh
timeout: 180
You could access the environment variables in scripts/runTests.sh like this:
# scripts/runTests.sh
echo "$BITBUCKET_BUILD_NUMBER"
# Or, use in some other valid way in your script
From the documentation of GitHub Pages deployment, it seems possible to deploy an application at repo A to the github pages of another repo B. In my use case, I would like to deploy to an organization github pages organization.github.io. Since the organization github pages only accept files in the master branch, I would like to develop the app at another repo.
So in my development repo (let's call it organization/app), I have such .travis.yml:
language: node_js
node_js:
- "node"
install:
- npm install
script:
- npm run lint
- npm run build
deploy:
provider: pages
local-dir: dist
github-token: $GITHUB_TOKEN
skip-cleanup: true
keep-history: true
repo: organization/organization.github.io
target-branch: master
on:
branch: master
Even though the repo and target-branch has been specified, Travis CI still deploys all build files to organization/app:gh-pages, notorganization/organization.github.io:master.
For a real word app, see this development repo and the CI deployment log.
I had a similar problem. Check if you run a build with right commit hash.
By restarting a build you got an old commit set.
You either set a flow that triggers a build or you trigger a custom build.
I am trying to setup continuous deployment for my Rails project. So far I have done following steps:
My app is on Github.
I have setup Travis CI.
I have created staging environment. (www.staging.myappname.com)
I have created prod environment. (www.myappname.com)
I have integrated Travis CI and Github.
What I am trying to achieve.
Someone creates a pull request.
Travis CI runs the build against pull request. (this part is done)
Once Pull request is merged into master branch then Travis CI run the test again. (this part is done)
If test is green then deploy master branch to staging environment. ( I can do this by adding deploy section to .travis.yml file.
Run test against staging environment, if test passes then deploy master branch to Production environment. ( I don't know how to achieve this part )
I am not sure if this is a right way to do it or not. I read couple of blog post and I noticed people creating different git branch for staging and production. Is this approach needed?
Also I can easily push my code to staging environment using Travis CI but I don't know how to run test again on staging environment and push code to production. What type of test shall I run against staging environment? Shall I only focus on selenium test for staging environment?
I can used tool like codeship but they offer only 100 build/month for free plan where as in Travis I can get unlimited build for free plan. This is the main reason for choosing Travis over codeship.
So my question:
Am I on right track?
What type of test shall I run against staging server?
how to deploy from staging to production using Travis CI?
Do I need staging.rb file in my rails app? If yes then how will it differ from production.rb file?
Do I need to create different git branch for staging and production? Currently I have only master branch which I am trying to deploy to both staging and production.
Usually people have 2 branches, one for staging/development which deploys on the staging server and one for production which deploys to the production branch
once your staging branch is tested and ready for deployment on production, you could create a pull request from staging to master (or just merge it locally and push it) and then the CI server should detect a new version on the master branch and then deploys it to the production server.