Skip to content

Instantly share code, notes, and snippets.

@HenryHengZJ
Last active February 20, 2023 06:47
Show Gist options
  • Save HenryHengZJ/627cec19671664a88754c7e383232dc8 to your computer and use it in GitHub Desktop.
Save HenryHengZJ/627cec19671664a88754c7e383232dc8 to your computer and use it in GitHub Desktop.
Host Outerbridge on AWS via Docker

Launch EC2 Instance

This walkthrough will skip how to launch an EC2 instance. There's plenty of resources and tutorial on how to do that. In this case we are launching a EC2 instance with t2.micro.

After EC2 instance has successfully spinned up, SSH into EC2 instance.

Install Docker

  1. Apply pending updates using the yum command:
sudo yum update
  1. Search for Docker package:
sudo yum search docker
  1. Get version information:
sudo yum info docker
  1. Install docker, run:
sudo yum install docker
  1. Add group membership for the default ec2-user so you can run all docker commands without using the sudo command:
sudo usermod -a -G docker ec2-user
id ec2-user
newgrp docker
  1. Install docker-compose:
sudo yum install python3-pip
sudo pip3 install docker-compose
  1. Enable docker service at AMI boot time:
sudo systemctl enable docker.service
  1. Start the Docker service:
sudo systemctl start docker.service

Install Git

sudo yum install git -y

Setup

  1. git clone https://github.com/Outerbridgeio/Outerbridge.git
    
  2. cd Outerbridge && cd docker
    
  3. docker-compose up -d
    
  4. App is now ready on port 3000.
  5. To view the app, create 2 new inbound rules on the EC2 instance. Custom TCP Port 3000 that allows anywhere to access.
  6. You can then view the app: "Your Public IPv4 DNS":3000. Example: http://ec2-18-222-246-22.eu-west-1.compute.amazonaws.com:3000
  7. You can bring the app down by:
docker-compose stop
  1. You can pull from latest image by:
docker pull outerbridgeio/outerbridge

How to control docker service

sudo systemctl start docker.service #<-- start the service
sudo systemctl stop docker.service #<-- stop the service
sudo systemctl restart docker.service #<-- restart the service
sudo systemctl status docker.service #<-- get the service status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment