I'm struggling to find an easy way to push my backend code from GitLab to AWS EC2. All tutorials and guides I found are really tiresome which is very strange to me because for uploading code to AWS S3 it's a piece of cake. Here is my gitlab-ci.yml
for S3 where I upload my frontend:
variables:
S3_BUCKET_PROD: "production-frontend"
S3_BUCKET_STAGE: "stage-frontend"
deploy-server-stage:
image: python:3.5
environment: stage
script:
- pip install awscli
- aws s3 cp dist s3://$S3_BUCKET_STAGE/ --recursive
only:
- stage
deploy-server-production:
image: python:3.5
environment: production
script:
- pip install awscli
- aws s3 cp dist s3://$S3_BUCKET_PROD/ --recursive
only:
- master
While for EC2 it's a journey through through .pem
's, chmod
's and even separate scripts written in .sh
file to pull code locally. Really, most tutorials are way to complicated for such common task.
It can't be that hard (like here for example) - I hope there is someone who managed it in easy and classy way. Right now the easiest way is to push it through ssh
from my machine, but it really shouldn't be like that.
In case if that matters: I'm talking about Node.js files so nothing fancy really.