-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #706 from jasonrandrews/new-LP
new Learning Path for Supervisor in a Docker container
- Loading branch information
Showing
13 changed files
with
497 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
additional_search_terms: | ||
- cloud | ||
- deploy | ||
|
||
|
||
layout: installtoolsall | ||
minutes_to_complete: 10 | ||
author_primary: Jason Andrews | ||
multi_install: false | ||
multitool_install_part: false | ||
official_docs: https://aws.github.io/copilot-cli/ | ||
test_images: | ||
- ubuntu:latest | ||
test_link: null | ||
test_maintenance: false | ||
test_status: | ||
- passed | ||
title: AWS Copilot CLI | ||
tool_install: true | ||
weight: 1 | ||
--- | ||
|
||
AWS Copilot CLI is an open source command line interface for running containers on AWS App Runner, Amazon Elastic Container Service (ECS), and AWS Fargate. | ||
|
||
It is available for a variety of operating systems and Linux distributions and supports the Arm architecture. | ||
|
||
## Before you begin | ||
|
||
This article provides quick solutions to install the latest version of AWS Copilot CLI for Ubuntu on Arm and macOS. | ||
|
||
Confirm you are using an Arm computer by running: | ||
|
||
```bash { target="ubuntu:latest" } | ||
uname -m | ||
``` | ||
|
||
If you are on Arm Linux the output should be: | ||
|
||
```output | ||
aarch64 | ||
``` | ||
|
||
If you are on macOS with Apple Silicon the output should be: | ||
|
||
```output | ||
arm64 | ||
``` | ||
|
||
## Download and install AWS Copilot CLI | ||
|
||
Copilot requires Docker. Refer to the [Docker](/install-guides/docker/) install guide for installation instructions. | ||
|
||
If you are using Docker on Linux you will need to install QEMU to build container images for both the `arm64` and the `amd64` architectures. | ||
|
||
```console | ||
sudo apt-get install qemu-user-static | ||
``` | ||
|
||
Docker Desktop for macOS includes the ability to build for multiple architectures, so you don't need to do anything extra. | ||
|
||
To install Copilot on Arm Linux: | ||
|
||
```console | ||
sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux-arm64 \ | ||
&& sudo chmod +x /usr/local/bin/copilot \ | ||
&& copilot --help | ||
``` | ||
|
||
To install Copilot on macOS: | ||
|
||
```console | ||
curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help | ||
``` | ||
|
||
Verify Copilot CLI is installed by running: | ||
|
||
```console | ||
copilot --version | ||
``` | ||
The version should be printed: | ||
|
||
```output | ||
copilot version: v1.33.0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
content/learning-paths/servers-and-cloud-computing/supervisord/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Access running containers using Supervisor, SSH, and Remote.It | ||
|
||
minutes_to_complete: 60 | ||
|
||
who_is_this_for: This is an introductory topic for software developers who want to learn how to run multiple services in a container and access running containers using Supervisor, SSH, and Remote.It during the debug and test phases of a project. | ||
|
||
learning_objectives: | ||
- Use Supervisor to run multiple services in a container | ||
- Access a container running in AWS Fargate without changing the security group for debug and test | ||
|
||
prerequisites: | ||
- An Arm Linux computer running Docker | ||
- An AWS account | ||
- A Remote.It account | ||
|
||
author_primary: Jason Andrews | ||
|
||
### Tags | ||
skilllevels: Introductory | ||
subjects: Performance and Architecture | ||
armips: | ||
- Neoverse | ||
- Cortex-A | ||
operatingsystems: | ||
- Linux | ||
tools_software_languages: | ||
- Docker | ||
- Remote.It | ||
- Supervisor | ||
|
||
### FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 1 # _index.md always has weight of 1 to order correctly | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. | ||
--- |
40 changes: 40 additions & 0 deletions
40
content/learning-paths/servers-and-cloud-computing/supervisord/_next-steps.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
next_step_guidance: > | ||
You may also be interested in Kubernetes on Arm. | ||
# 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended. | ||
|
||
recommended_path: "/learning-paths/servers-and-cloud-computing/eks-multi-arch/" | ||
# Link to the next learning path being recommended. | ||
|
||
|
||
# further_reading links to references related to this path. Can be: | ||
# Manuals for a tool / software mentioned (type: documentation) | ||
# Blog about related topics (type: blog) | ||
# General online references (type: website) | ||
|
||
further_reading: | ||
- resource: | ||
title: Run multiple processes in a container | ||
link: https://docs.docker.com/config/containers/multi-service_container/ | ||
type: documentation | ||
- resource: | ||
title: Supervisor with Docker Lessons learned | ||
link: https://advancedweb.hu/supervisor-with-docker-lessons-learned/ | ||
type: blog | ||
- resource: | ||
title: Multiple services in a Docker container with supervisord | ||
link: https://dev.to/pratapkute/multiple-services-in-a-docker-container-with-supervisord-2g13 | ||
type: blog | ||
|
||
|
||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
weight: 21 # set to always be larger than the content in this path, and one more than 'review' | ||
title: "Next Steps" # Always the same | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
41 changes: 41 additions & 0 deletions
41
content/learning-paths/servers-and-cloud-computing/supervisord/_review.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
# ================================================================================ | ||
# Edit | ||
# ================================================================================ | ||
|
||
# Always 3 questions. Should try to test the reader's knowledge, and reinforce the key points you want them to remember. | ||
# question: A one sentence question | ||
# answers: The correct answers (from 2-4 answer options only). Should be surrounded by quotes. | ||
# correct_answer: An integer indicating what answer is correct (index starts from 0) | ||
# explanation: A short (1-3 sentence) explanation of why the correct answer is correct. Can add additional context if desired | ||
|
||
|
||
review: | ||
- questions: | ||
question: > | ||
Is it possible to start multiple services in a container? | ||
answers: | ||
- "Yes" | ||
- "No" | ||
correct_answer: 1 | ||
explanation: > | ||
You can use Supervisor, a process control system, to start multiple services in a container. | ||
- questions: | ||
question: > | ||
You must open a port to be able to reach a running container using SSH. | ||
answers: | ||
- "True" | ||
- "False" | ||
correct_answer: 2 | ||
explanation: > | ||
You can reach a local container using docker exec and a remote container using Remote.It. There are other services to each containers, but Remote.It is a good example of how to do it. | ||
# ================================================================================ | ||
# FIXED, DO NOT MODIFY | ||
# ================================================================================ | ||
title: "Review" # Always the same title | ||
weight: 20 # Set to always be larger than the content in this path | ||
layout: "learningpathall" # All files under learning paths have this same wrapper | ||
--- |
Binary file added
BIN
+170 KB
content/learning-paths/servers-and-cloud-computing/supervisord/apache.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.5 KB
content/learning-paths/servers-and-cloud-computing/supervisord/connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.1 KB
content/learning-paths/servers-and-cloud-computing/supervisord/endpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions
120
content/learning-paths/servers-and-cloud-computing/supervisord/example.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
--- | ||
# User change | ||
title: "Install Supervisor, SSH, and Remote.It" | ||
weight: 3 | ||
|
||
layout: "learningpathall" | ||
|
||
--- | ||
|
||
You can update the container to install Supervisor and create a container with multiple services. | ||
|
||
The `Dockerfile` below includes some extra software for debug and test. | ||
|
||
Here are the changes: | ||
- Install SSH and enable password login | ||
- Install and configure Remote.It | ||
- Add a Supervisor configuration file | ||
|
||
Use a text editor to replace your `Dockerfile` with the new file below: | ||
|
||
```console | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt-get update && apt-get install -y curl iproute2 sudo openssh-server sudo vim apache2 supervisor procps uuid-runtime | ||
|
||
# Configure SSH for password login | ||
RUN mkdir -p /var/run/sshd | ||
RUN sed -i '/PasswordAuthentication no/c\PasswordAuthentication yes' /etc/ssh/sshd_config | ||
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | ||
|
||
# Configure Remote.It | ||
RUN mkdir -p /etc/remoteit | ||
RUN touch /etc/remoteit/registration | ||
RUN sh -c "$(curl -L https://downloads.remote.it/remoteit/install_agent.sh)" | ||
|
||
# Configure Supervisor | ||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
# Setup default user | ||
RUN useradd --create-home -s /bin/bash -m ubuntu && echo "ubuntu:ubuntu" | chpasswd && adduser ubuntu sudo | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
EXPOSE 80 | ||
CMD ["/usr/bin/supervisord"] | ||
``` | ||
|
||
You will also need a configuration file for Supervisor. | ||
|
||
Use a text editor to create a file named `supervisord.conf` with the contents: | ||
|
||
```console | ||
[supervisord] | ||
user=root | ||
nodaemon=true | ||
logfile = /var/log/supervisord.log | ||
pidfile=/var/run/supervisord.pid | ||
|
||
[program:sshd] | ||
command=/usr/sbin/sshd -D | ||
|
||
[program:remoteit-agent] | ||
command=/usr/share/remoteit/refresh.sh | ||
|
||
[program:apache2] | ||
command=/usr/sbin/apache2ctl -DFOREGROUND | ||
``` | ||
|
||
Build the container using: | ||
|
||
```console | ||
docker build -t supervisord-dev . | ||
``` | ||
|
||
Before running the container you need a registration code from Remote.It. | ||
|
||
Log in to your account at https://app.remote.it | ||
|
||
From the dashboard click the + icon and select the Linux icon to add a new device. | ||
|
||
Copy the generated registration code by clicking the bar code symbol under COPY as shown below: | ||
|
||
![Registration code #center](remoteit-code.png) | ||
|
||
With this code you can launch the container. Substitute your registration code instead of the one shown: | ||
|
||
```console | ||
docker run -d -e R3_REGISTRATION_CODE=416ED829-D9D8-532C-B1FE-13548929B2A1 -p 80:80 supervisord-dev | ||
``` | ||
|
||
Once the container starts on your local machine you can open your browser to [https://localhost](http://localhost) and see the Apache welcome screen. | ||
|
||
You will also see the device in your Remote.It dashboard. | ||
|
||
In the dashboard, start the SSH connection by clicking the CONNECT bar as shown below: | ||
|
||
![Connect #center](connect.png) | ||
|
||
Once connected, get the values for the PUBLIC ENDPOINT | ||
|
||
![Public endpoint #center](endpoint.png) | ||
|
||
You can now SSH directly into the container. The username for the container is `ubuntu` and the password is also `ubuntu`. If desired, you can change this in the Dockerfile. | ||
|
||
Change to your endpoint values in the command below to SSH: | ||
|
||
```console | ||
ssh ssh://ubuntu@proxy18.rt3.io:32443 | ||
``` | ||
|
||
You are now inside the container as the `ubuntu` user. | ||
|
||
Notice the SSH port was not shared by the container. | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.