Update Native Setup and Vagrant Setup
This commit is contained in:
@ -1,73 +0,0 @@
|
||||
default: &default
|
||||
flowr:
|
||||
# When enabled, flowr can assist learners with related search results from
|
||||
# StackOverflow.com regarding exceptions that occurred during code execution.
|
||||
# The search is initiated through the learners' browser and displayed in the output pane.
|
||||
enabled: false
|
||||
# The number of search results to be displayed
|
||||
answers_per_query: 3
|
||||
|
||||
code_pilot:
|
||||
# When enabled, CodePilot can be used by learners to request individual help by a tutor
|
||||
# through a video conferencing system. Optionally, it also provides access to recordings
|
||||
# of previous sessions. Support for CodePilot is currently in beta.
|
||||
enabled: false
|
||||
# The root URL of CodePilot
|
||||
url: //localhost:3000
|
||||
|
||||
codeharbor:
|
||||
# When enabled, CodeHarbor is integrated in the teachers' view and allows importing
|
||||
# and exporting exercises from CodeOcean using the ProFormA XML format to CodeHarbor.
|
||||
enabled: false
|
||||
# The root URL of CodeHarbor
|
||||
url: https://codeharbor.openhpi.de
|
||||
|
||||
codeocean_events:
|
||||
# When enabled, learner-specific events within the editor are stored and can be used
|
||||
# as part of learning analytics. This setting enables the JavaScript event handlers.
|
||||
enabled: false
|
||||
|
||||
prometheus_exporter:
|
||||
# When enabled, a dedicated endpoint using the Prometheus format is offered and might
|
||||
# be used by a Prometheus-compatible monitoring system. Exported metrics include absolute
|
||||
# counters of all relations with specific support for Request-for-Comments.
|
||||
enabled: false
|
||||
|
||||
runner_management:
|
||||
# When enabled, CodeOcean delegates the handling and management of (containerized) runners
|
||||
# to a dedicated runner management. Otherwise, code executions are performed locally using
|
||||
# Docker and without pre-warming support (one container per execution).
|
||||
enabled: true
|
||||
# The strategy to use. Possible values are: poseidon, docker_container_pool
|
||||
strategy: docker_container_pool
|
||||
# The root URL of the runner management to use
|
||||
# If a hostname is specified and the target host is reachable via IPv6, the WebSocket
|
||||
# connection might not use the IPv6-to-IPv4 fallback but rather fail unexpectedly.
|
||||
url: http://127.0.0.1:7100
|
||||
# The root certificate authority to trust for TLS connections to the runner management (Poseidon only)
|
||||
# ca_file: /example/certificates/ca.crt
|
||||
# The authorization token for connections to the runner management (Poseidon only)
|
||||
# If TLS support is not enabled, this token is transmitted in clear text!
|
||||
# token: SECRET
|
||||
# The maximum time in seconds a runner may idle at the runner management before it is removed.
|
||||
# Each begin of an interaction with the runner resets this time. Thus, this value should
|
||||
# be truly greater than any permitted execution time of an execution environment.
|
||||
unused_runner_expiration_time: 180
|
||||
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
flowr:
|
||||
enabled: true
|
||||
codeharbor:
|
||||
enabled: true
|
||||
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
prometheus_exporter:
|
||||
enabled: true
|
||||
|
||||
|
||||
test:
|
||||
<<: *default
|
@ -1,14 +1,17 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd /home/vagrant/codeocean
|
||||
|
||||
######## VERSION INFORMATION ########
|
||||
|
||||
postgres_version=14
|
||||
node_version=14
|
||||
ruby_version=2.7.6
|
||||
|
||||
########## INSTALL SCRIPT ###########
|
||||
postgres_version=15
|
||||
node_version=lts/hydrogen
|
||||
ruby_version=$(cat .ruby-version)
|
||||
|
||||
DISTRO="$(lsb_release -cs)"
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
|
||||
########## INSTALL SCRIPT ###########
|
||||
|
||||
# Disable any optimizations for comparing checksums.
|
||||
# Otherwise, a hash collision might prevent apt to work correctly
|
||||
@ -16,83 +19,40 @@ DISTRO="$(lsb_release -cs)"
|
||||
sudo mkdir -p /etc/gcrypt
|
||||
echo all | sudo tee /etc/gcrypt/hwf.deny
|
||||
|
||||
# Always set language to English
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
|
||||
# Prerequisites
|
||||
sudo apt -qq update
|
||||
sudo apt -qq -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common firefox firefox-geckodriver libpq-dev libicu-dev acl
|
||||
sudo apt -qq -y install ca-certificates curl libpq-dev libicu-dev
|
||||
sudo apt -qq -y upgrade
|
||||
|
||||
# PostgreSQL
|
||||
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
echo "deb https://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
||||
sudo apt -qq update && sudo apt -qq install -y postgresql-client-$postgres_version postgresql-$postgres_version
|
||||
|
||||
sudo sed -i "/# TYPE/q" /etc/postgresql/$postgres_version/main/pg_hba.conf
|
||||
sudo tee -a /etc/postgresql/$postgres_version/main/pg_hba.conf <<EOF
|
||||
# code_ocean: drop access control
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
EOF
|
||||
sudo systemctl restart postgresql
|
||||
|
||||
# Install node
|
||||
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
|
||||
echo "deb https://deb.nodesource.com/node_$node_version.x $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||
echo "deb-src https://deb.nodesource.com/node_$node_version.x $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
|
||||
sudo apt -qq update && sudo apt -qq install -y nodejs
|
||||
|
||||
# yarn
|
||||
curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
sudo apt -qq update && sudo apt -qq install -y yarn
|
||||
|
||||
# Docker
|
||||
curl -sSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$DISTRO \
|
||||
stable"
|
||||
sudo apt -qq update && sudo apt -qq -y install docker-ce docker-ce-cli containerd.io
|
||||
|
||||
sudo usermod -aG docker ${USER}
|
||||
|
||||
sudo tee -a /etc/docker/daemon.json <<EOF
|
||||
{
|
||||
"userns-remap": "default"
|
||||
}
|
||||
EOF
|
||||
|
||||
sudo mkdir -p /etc/systemd/system/docker.service.d/
|
||||
sudo tee -a /etc/systemd/system/docker.service.d/override.conf <<EOF
|
||||
[Service]
|
||||
# Empty line is required
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://127.0.0.1:2376
|
||||
EOF
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
|
||||
# Pull example docker image
|
||||
sudo docker pull openhpi/co_execenv_python:3.8
|
||||
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
|
||||
echo "deb [arch=$ARCH] http://apt.postgresql.org/pub/repos/apt $DISTRO-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
||||
sudo apt-get update && sudo apt-get -y install postgresql-$postgres_version postgresql-client-$postgres_version
|
||||
sudo -u postgres createuser $(whoami) -ed
|
||||
|
||||
# RVM
|
||||
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
|
||||
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
||||
curl -sSL https://get.rvm.io | bash -s stable
|
||||
source "/home/vagrant/.profile"
|
||||
source ~/.rvm/scripts/rvm
|
||||
|
||||
# ruby
|
||||
# Install NodeJS (without NVM)
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm install $node_version
|
||||
|
||||
# Enable Yarn
|
||||
corepack enable
|
||||
|
||||
# Install Ruby
|
||||
rvm install $ruby_version
|
||||
rvm use $ruby_version --default
|
||||
|
||||
# bundler
|
||||
gem install bundler
|
||||
|
||||
######## CODEOCEAN INSTALL ##########
|
||||
cd /home/vagrant/codeocean
|
||||
|
||||
# config
|
||||
for f in action_mailer.yml database.yml secrets.yml docker.yml.erb mnemosyne.yml content_security_policy.yml
|
||||
# Prepare config
|
||||
for f in action_mailer.yml code_ocean.yml content_security_policy.yml database.yml docker.yml.erb mnemosyne.yml secrets.yml
|
||||
do
|
||||
if [ ! -f config/$f ]
|
||||
then
|
||||
@ -100,29 +60,39 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
# We want to use a preconfigured code_ocean.yml file which is using the DockerContainerPool
|
||||
if [ ! -f config/code_ocean.yml ]
|
||||
then
|
||||
cp provision/code_ocean.vagrant.yml config/code_ocean.yml
|
||||
fi
|
||||
|
||||
# install dependencies
|
||||
# Install dependencies
|
||||
bundle install
|
||||
yarn install
|
||||
|
||||
# create database
|
||||
export RAILS_ENV=development
|
||||
rake db:create
|
||||
rake db:schema:load
|
||||
rake db:migrate
|
||||
rake db:seed
|
||||
# Initialize database
|
||||
rake db:setup
|
||||
|
||||
# Always set language to English
|
||||
sudo locale-gen en_US en_US.UTF-8
|
||||
######## NOMAD INSTALL ########
|
||||
|
||||
# Set ACL to ensure access to files created by Docker
|
||||
mkdir -p tmp/files
|
||||
setfacl -Rdm user:codeocean:rwx tmp/files
|
||||
# Install Nomad
|
||||
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null
|
||||
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
|
||||
sudo apt update && sudo apt-get -y install nomad
|
||||
sudo systemctl enable nomad
|
||||
sudo systemctl start nomad
|
||||
|
||||
#### DOCKERCONTAINERPOOL INSTALL ####
|
||||
../dockercontainerpool/provision.sh
|
||||
# Enable Memory Oversubscription
|
||||
until curl -s --fail http://localhost:4646/v1/agent/health ; do sleep 1; done
|
||||
curl -X POST -d '{"SchedulerAlgorithm": "spread", "MemoryOversubscriptionEnabled": true}' http://localhost:4646/v1/operator/scheduler/configuration
|
||||
|
||||
# Install Docker
|
||||
curl -fsSL https://get.docker.com | sudo sh
|
||||
|
||||
######## POSEIDON INSTALL ########
|
||||
|
||||
# Install Golang
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 52B59B1571A79DBC054901C0F6BC817356A3D45E
|
||||
gpg --export 52B59B1571A79DBC054901C0F6BC817356A3D45E | sudo tee /usr/share/keyrings/golang-backports.gpg >/dev/null
|
||||
echo "deb [signed-by=/usr/share/keyrings/golang-backports.gpg] https://ppa.launchpadcontent.net/longsleep/golang-backports/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/golang.list
|
||||
sudo apt-get update && sudo apt-get -y install golang
|
||||
|
||||
# Install Poseidon
|
||||
cd ../poseidon
|
||||
cp configuration.example.yaml configuration.yaml
|
||||
make bootstrap
|
||||
make build
|
||||
|
Reference in New Issue
Block a user