Skip to content

Update deploy.yml

Update deploy.yml #8

Workflow file for this run

name: alhazenlabs-ec2-deployment
on:
push:
branches: [main]
jobs:
start:
runs-on: ubuntu-latest
environment: AWS-EC2-T2-MICRO
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Deploy
run: echo "Deployment to AWS EC2 is beggining..."
- name: Deploy in EC2
env:
PRIVATE_KEY: ${{ secrets.AWS_EC2_PRIVATE_KEY }}
HOST_NAME : ${{ secrets.AWS_EC2_HOST }}
USER_NAME : ubuntu
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOST_NAME} 'bash -s' < deploy.sh
echo "removing the stored key from the machine"
rm -f private_key
## Setting up your Domain
# So far, users can access the site using the Elastic IP. However, it can be difficult to remember and share so we will configure a custom domain name.
# To get started, you need to first purchase a domain. This can range from $10 to $1,000+s. Amazon has a service called Route53 you can use or you can choose other providers such as [Google Domains](https://domains.google/), [GoDaddy](https://www.godaddy.com/), etc. (we used Google for AlgoAcademy which was $10/year).
# There are two steps you would need to configure to connect the project with a custom domain:
# - Create domain records with DNS registrar
# - Configure NGINX on the EC2 instance to recognize the domain
# ---
# ### _Creating Domain records_
# Let's start with configuring our DNS with records:
# - Go to the **DNS** portion of your registrar.
# - Find where you can create custom resource records.
# Set the records like so:
# | Name | Type | TTL | Data |
# | ---- | :---: | :-: | ----------------------: |
# | @ | A | 1h | YOUR-ELASTIC-IP-ADDRESS |
# | www | CNAME | 1h | your-awesome-site.com |
# ### _Configuring our Web Server_
# Edit the NGINX config file inside your EC2 instance: