Take a look at the Backlog in the Project Page to see our priorities. You are more than welcome to contribute any PR regardless if it's listed or not.
curl -L https://nixos.org/nix/install | sh
nix-shell -v
brew install openjdk@17 sbt nodejs yarn
Assuming you use Git for Windows >= 2.16.2.1 (note this will erase uncommitted changes):
git config --add core.symlinks true
git reset --hard HEAD
choco install nvm yarn sbt openjdk17 python3
nvm install 8.9.1
nvm use 8.9.1
(npm >= 9.0.0 may have issues finding/using python)
sbt
> startAll
in a separate terminal, start the vite dev server by running yarn dev
in the root directory of the repository
open http://localhost:8080
then run ~client/fastLinkJS
if you work on client part
or ~sbtRunner/reStart;server/reStart
if you work on the server part.
you can also open http://localhost:8080/embed.html
to edit the embedded style
Start the sbt production server:
sbt
> startAllProd
open http://localhost:9000
Make sure to run bin/scalafmt
to format your code.
You can install a pre-commit hook with bin/hooks.sh
.
├── api | autowire api (rpc server <=> browser)
│ | models for server <=> sbt (akka-remote)
├── balancer | distribute load based on sbt configuration
├── bin | scalfmt runner
├── build.sbt | build definition
├── client | Scala.js & scalajs-react code for the frontend
├── demo | cool examples to try in scastie
├── deployment | production configurations
├── docker | Dockerfile for sbt images
├── instrumentation | Worksheet implementation
├── project | build extras like Deployment or Scala.js packaging and plugins
├── runtime-dotty | see `runtime-scala`
├── runtime-scala | methods exposed inside scastie
├── sbt-runner | remote actor communicating with sbt instance over I/O streams
├── sbt-scastie | sbt plugin to report errors and console output with the `sbt-api` model
├── metals-runner | server responsible for managing metals instances to provide interactive features
├── server | web server
└── utils | read/writte files
Scala.js Client run/save/format +-------------------------------------------+
+---------------------+ AutowireApi +---------------------+ +-------------------------------------------+|
| ScastieBackend | (HTTP) | +------------+ | akka+remote +-------------------------------------------+||
| +--------+ +-----------------> | |LoadBalancer| <------------------+ | SbtActor Sbt(Process) |||
| | | | | +------------+ | | | +----------+ +-----------+ |||
| | | | | | +---> | | <-----> |sbt|scastie| ||+
| | | | | | | +----------+ I/O Stream +-----------+ ++
| | | | | | +-------------------------------------------+
| | | | | |
| | | | | |
| | | | | |
| | | | | SnippetContainer(DB)|
| | | | | |
| | | | <-----------------+ oauth |
| +--------+ | SnippetProgress | static ressources |
| | (sse/websocket) +---------------------+
| InteractiveProvider |
| +--------+ | +---------------------+
| | | | | |
| | | | | MetalsRunnerServer |
| | +-------------------> | |
| | | | (HTTP request) | |
| +--------+ | | |
| | | |
+---------------------+ +---------------------+
Editor: http://asciiflow.com/
If you have any questions join us in the gitter channel
The whole deployment process is done semi-automatically via SBT task.
ssh [email protected]
ssh [email protected]
docker login
cd ~/scastie && git pull && ~/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl ~/.nix bash -l
nix-shell -v
sbt
To deploy new version of scastie, you need to first build and push docker images.
In order to do it, you should run publishContainers
.
You should do it only when you're sure that containers are working as intended.
Using this task automatically replaces latest
image on the docker repository.
Scastie offers multiple deployment configurations with following instructions for each of them.
If you didn't make any changes to the deployment task, it should finish with success. Otherwise, the deployment will fail and inform you that remote deployment scripts are not up-to-date with their local counterparts. In such situation you should follow the instructions from the sbt console.
Every IP which is put into the configuration should be double-checked. If you have any doubts if they are correct, please contact one of the maintainers.
Scastie production environment is used for internal deployment. Its configuration is present at ./deployment/production.conf
.
Production requires mongodb-prod.conf
file to be in the same directory as production.conf
configuration file.
The template for this file is located at ./deployment/mongodb.template.conf
It also requires OAuth2 configuration at oauth2-prod.conf
in the same directory as production.conf
Instructions
ssh [email protected]
ssh [email protected]
docker login
cd ~/scastie && git pull && ~/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl ~/.nix bash -l
nix-shell -v
sbt
In case docker images are not published e.g. when staging for the current version is not deployed, it must be done before proceeding with the production deployment. It is done by running:
sbt> publishContainers
Then deployment can be started by running deploy
sbt task.
sbt> deploy
Scastie also has a staging environment. The deployment can be done by running the task deployStaging
.
It will do normal deployment, but with Staging environment configuration file located at: ./deployment/staging.conf
Staging requires mongodb-staging.conf
file to be in the same directory as staging.conf
configuration file.
The template for this file is located at ./deployment/mongodb.template.conf
It also requires OAuth2 configuration at oauth2-staging.conf
in the same directory as staging.conf
Instructions
ssh [email protected]
ssh [email protected]
docker login
cd ~/scastie && git pull && ~/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl ~/.nix bash -l
nix-shell -v
sbt
sbt> publishContainers
sbt> deployStaging
Scastie deployment process generates shell scripts responsible for proper remote deployment.
If in any case you want to check the scripts without running them, it can be done by running
deployDryRun
sbt task.
The deployment process is sequential, so if the process fails on any step, it will be stopped, so only one part of the system will be affected. You will need to manually restart failed step.
ssh [email protected]
ssh [email protected]
tail -F -n1000 output.log
ssh [email protected]
~/log.sh
- You need access to
[email protected]
,https://github.com/scalacenter/scastie-secrets
,http://scala-webapps.epfl.ch:8081
and be a member ofhttps://hub.docker.com/u/scalacenter/
These people have access:
-
see
production.conf
file for current production configuration, notably it uses mongodb instead of local file storage -
Install docker (note that Windows is not recommended due to networking issues)
-
do
docker login
-
bump the version in build.sbt
-
tag and commit the new version
-
Run this command locally:
sbt deploy
-
Make sure everything went well: https://scastie.scala-lang.org
In case anything goes wrong:
ssh [email protected]
ssh [email protected]
ssh [email protected]
./production/deploy-runners.sh
./production/deploy-metals.sh
exit
./server.sh
Running with docker locally works only with linux for now ( it won't work on macOS )
It can be started by running sbt deployLocal
command.