<commit_before># Development inside a CoCalc project

Scripts for doing development of CoCalc inside of a CoCalc project.

**Requirement:** 1.5GB RAM and 1GB disk space

## Initial check

Things you might want to check when starting a new cocalc dev task. Use a .term for these.

- If you think your project has state left over from previous development, you might want to remove or move aside:
  - ~/.local (but see below about installing `forever` command)
  - ~/.smc (you MUST restart your project if you delete this directory)
  - ~/.npm
  - any files in ~/bin that override system commands

- It also helps to restart your project before starting a new dev task, to kill leftover processes and environment settings.
  * If you delete `~/.smc`, you **must** restart your project

## Setup

Make a fork of the cocalc repository (optionally) and then clone via `git clone --recursive git://...`.
You should have a `$HOME/cocalc` directory now.

Run `npm run make` inside the `cocalc/src/` subdirectory.
This will install all the dependencies and does some additional setup.

If you ever need to update dependencies or think there is a problem with them,
just run `npm run clean` to get rid of them and run `npm run make` again.

If, after running `npm run clean`, `which forever` produces empty output, do
```
npm install --prefix=~/.local -g forever
```
before running `npm run make`. (`forever` should be installed globally, though)


## The servers

Explicitly start each of the following scripts in their own terminal session (they will run in the foreground).  Make sure to set the environment with `source smc-env` first:

- `./start_postgres.py`

- `./start_webpack.py`

- `./start_hub.py`


## Information

Type `./info.py` to get the URL where you can reach your own running copy of CoCalc.  This is accessible precisely to collaborators on your project and **nobody** else.

## Running all servers at once with tmux

If you want, you can start several different services at once

    ./tmux-start-all

to create a single tmux session with each of the servers running.

## Changing the web frontend

Try editing smc-webapp/r_help.cjsx, e.g., changing the heading "Support" to something else.  Watch the webpack process notice the change and build.   Refresh your browser and see the change.


## Changing the hub server backend<commit_msg>./tmux-start-all didn't work figured out I had to do dev/project/tmux-start-all<commit_after># Development inside a CoCalc project

Scripts for doing development of CoCalc inside of a CoCalc project.

**Requirement:** 1.5GB RAM and 1GB disk space

## Initial check

Things you might want to check when starting a new cocalc dev task. Use a .term for these.

- If you think your project has state left over from previous development, you might want to remove or move aside:
  - ~/.local (but see below about installing `forever` command)
  - ~/.smc (you MUST restart your project if you delete this directory)
  - ~/.npm
  - any files in ~/bin that override system commands

- It also helps to restart your project before starting a new dev task, to kill leftover processes and environment settings.
  * If you delete `~/.smc`, you **must** restart your project

## Setup

Make a fork of the cocalc repository (optionally) and then clone via `git clone --recursive git://...`.
You should have a `$HOME/cocalc` directory now.

Run `npm run make` inside the `cocalc/src/` subdirectory.
This will install all the dependencies and does some additional setup.

If you ever need to update dependencies or think there is a problem with them,
just run `npm run clean` to get rid of them and run `npm run make` again.

If, after running `npm run clean`, `which forever` produces empty output, do
```
npm install --prefix=~/.local -g forever
```
before running `npm run make`. (`forever` should be installed globally, though)


## The servers

Explicitly start each of the following scripts in their own terminal session (they will run in the foreground).  Make sure to set the environment with `source smc-env` first:

- `./start_postgres.py`

- `./start_webpack.py`

- `./start_hub.py`


## Information

Type `./info.py` to get the URL where you can reach your own running copy of CoCalc.  This is accessible precisely to collaborators on your project and **nobody** else.

## Running all servers at once with tmux

If you want, you can start several different services at once

    dev/project/tmux-start-all

to create a single tmux session with each of the servers running.

## Changing the web frontend

Try editing smc-webapp/r_help.cjsx, e.g., changing the heading "Support" to something else.  Watch the webpack process notice the change and build.   Refresh your browser and see the change.


## Changing the hub server backend
{'fraction_non_alphanumeric': 0.07726130653266332, 'fraction_numerical': 0.001256281407035176, 'mean_word_length': 3.777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4594072', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1290, 'n_words': 712}