-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
830751c
commit 8a66c94
Showing
17 changed files
with
101 additions
and
197 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,6 @@ | ||
FROM ubuntu:22.04 | ||
WORKDIR /provision | ||
COPY ./ubuntu_setup.sh ./ | ||
RUN ./ubuntu_setup.sh | ||
EXPOSE 22 | ||
CMD ["/usr/sbin/sshd", "-D"] |
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,22 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export DEBIAN_FRONTEND=noninteractive | ||
apt -y update | ||
|
||
# Create `deployer` user that can sudo without a password | ||
apt-get -y install sudo | ||
adduser --disabled-password deployer < /dev/null | ||
echo "deployer:topsecret" | chpasswd | ||
echo "deployer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Install and configure sshd | ||
apt-get -y install openssh-server | ||
{ | ||
echo "Port 22" | ||
echo "PasswordAuthentication yes" | ||
echo "ChallengeResponseAuthentication no" | ||
} >> /etc/ssh/sshd_config | ||
mkdir /var/run/sshd | ||
chmod 0755 /var/run/sshd |
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 |
---|---|---|
|
@@ -3,6 +3,5 @@ | |
bin/rake | ||
.bundle | ||
.yardoc | ||
.vagrant* | ||
test/tmp | ||
Gemfile.lock |
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
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
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
name: sshkit | ||
|
||
services: | ||
ssh_server: | ||
build: | ||
context: .docker | ||
ports: | ||
- "2122:22" |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ def setup | |
end | ||
|
||
def a_host | ||
VagrantWrapper.hosts['one'] | ||
DockerWrapper.host | ||
end | ||
|
||
def test_simple_netssh | ||
|
24 changes: 0 additions & 24 deletions
24
test/functional/test_ssh_server_comes_up_for_functional_tests.rb
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Minitest.after_run do | ||
DockerWrapper.stop if DockerWrapper.running? | ||
end | ||
|
||
module DockerWrapper | ||
class << self | ||
def host | ||
SSHKit::Host.new( | ||
user: "deployer", | ||
hostname: "localhost", | ||
port: "2122", | ||
password: "topsecret", | ||
ssh_options: host_verify_options | ||
) | ||
end | ||
|
||
def running? | ||
out, status = run_compose_command("ps --status running", false) | ||
status.success? && out.include?("ssh_server") | ||
end | ||
|
||
def start | ||
run_compose_command("up -d") | ||
end | ||
|
||
def stop | ||
run_compose_command("down") | ||
end | ||
|
||
private | ||
|
||
def run_compose_command(command, echo=true) | ||
$stderr.puts "[docker compose] #{command}" if echo | ||
stdout, stderr, status = Open3.capture3("docker compose #{command}") | ||
|
||
output = stdout + stderr | ||
output.each_line { |line| $stderr.puts "[docker compose] #{line}" } if echo | ||
|
||
[output, status] | ||
end | ||
|
||
def host_verify_options | ||
if Net::SSH::Version::MAJOR >= 5 | ||
{ verify_host_key: :never } | ||
else | ||
{ paranoid: false } | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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