Development inside an SMC project
Scripts for doing development of SMC inside of an SMC 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
~/.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.
Setup
Run npm run make
inside the 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
before running npm run make
.
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 SMC. 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
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
Edit files in smc-hub, e.g., hub.coffee
. Then hit control+c, then run ./start_hub.py
again. It's slightly faster if you comment out the ./update_schema.coffee
line in ./start_hub.py
, which is safe unless the schema changes.
Connecting directly to the compute client from command line
Set the environment variable, e.g.,
From the directory ~/smc/src
you can do:
Then use the db object's methods. After doing the above (or starting the hub once), then the smc
database will be created, and you can do
Add this line to your ~/.bashrc to set the environment automatically on login:
Creating an admin user
You can get the account id's by doing:
Then, to make your user into an admin, do this from the root of your install:
Now refresh your browser, and in account settings some new admin configuration options will appear in the lower right. Also, you can open any project (though some things may look messed up).
You can also confirm that you're user is now an admin: