Getting Started with Net.Create
Net.Create Installation Choices
The Net.Create environment and its dependencies
Net.Create requires several software packages to run. That is, it has the following dependencies:
- MacOS or Digital Ocean (a Linux-based operating system). We suggest Digital Ocean for folks who want to access Net.Create from many different places. Net.Create does not run on Windows machines (yet).
- NodeJS is a set of Javascript libraries that build the network nodes and edges, let users drag the graph around and hide/display the Node/Edge tables.
- Node Package Manager (npm) and Brunch help keep those libraries up to date
- XCode provides the programming infrastructure that helps MacOS run these libraries and javascript packages.
Choosing Your Net.Create Install Platform: MacOS or WindowsDigital Ocean
Net.Create can run locally on your computer if you have a Mac. If your personal computing device is a Windows machine, you’ll need to use Digital Ocean, a cloud server (~$5/month). Follow one of those two paths in this section before you move on to the “Installing Net.Create” section.
If your personal computer is a Mac…
You can install Net.Create on your Mac directly.
Net.Create isn’t double-clickable, either when you run it or when you install it. Instead, it uses a set of commands typed in at the command line. Installing Net.Create requires a number of these commands in sequence. Running it only requires 1.
The Net.Create Wiki has a full set of environment, dependency and code installation instructions:
If you are running Net.Create on an Apple with an M1 chip (or you’re not sure):
- Go to your apple menu and choose “About This Mac”
- Look at the line that starts with “Chip”. If this line reads “Chip Apple M1”, you need to enter an additional command in your terminal:
arch -x86_64 zsh
For folks new to command-line installs
There are a few points along the way where users less familiar with the command line might run into trouble. Read these first so you can work out which steps you’ll need to modify and how you’ll need to modify them:
- Step 4 varies based on your MacOS version
- If you are running MacOS earlier than Catalina or Digital Ocean, use:
touch .bash_profile
andtouch .bashrc
- If you are running Catalina or later, use:
touch .zshrc
- If you are running MacOS earlier than Catalina or Digital Ocean, use:
- Step 6 has two variations.
- First check the NVM install page to make sure you are using the most recent version.
- Then, look for what programmers call a pipe, the vertical line after “install.sh” that looks like this:
|
. Pipes separate the main part of a command in the command line from an extension of that command that might have some variances from system to system. Adjust what comes after it based on your MacOS.- Earlier than Catalina:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
- Catalina or later:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | zsh
- Remember that spaces also act as separators in the command line. You’ll need a space before and after the pipe.
- Earlier than Catalina:
- If step 8 fails, you may need to check your /User/yourname/ folder for a file called
.zshrc
or.bash_profile
.- These files are hidden by default. Open your main user directory and press
Command
+Shift
+.
(period) to show hidden files. - You will have either
.zshrc
or.bash_profile
in that folder. Right-click it and use the “Open With” option to open this file with the application “Text Edit” - If this file is blank, you need to add four lines of environment variables (copied and pasted below) and then save the file
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
- Finally, type “exit” in your terminal window, quit out of the terminal, and then reopen your terminal window.
- These files are hidden by default. Open your main user directory and press
If your personal computer is a Windows/Linux machine
You’ll need to install Net.Create on a cloud server using Digital Ocean (~$5/month) or you need a local Ubuntu install (the later of which we cannot support).
- In Digital Ocean: Create -> Droplet . For full instructions see https://docs.digitalocean.com/products/droplets/how-to/create/
- Select the following settings:
- Ubuntu for the distribution
- Basic for the plan
- Regular Intel for the CPU option
- The $5 per month plan (unless you expect an enormous amount of traffic)
- The default data center with no added storage
- For security and access, the “password” option is easier to manage but if you are comfortable with SSH logins, it won’t affect your Net.Create install. You can leave the other information like host name unchanged if you are less familiar with server setups; if you are familiar with server setups, changes here won’t significantly affect your Net.Create install.
- Wait for the new droplet to be setup.
- It will appear under the project where it was created, or via the droplet menu on the left.
- The blue bar shows how far along it is in setting up. This should only take a few minutes).
- Click on the droplet name either in the project or list of droplets
- Click on Access on the left
- Click on launch droplet console to access the console
- Create the “shell environment variables” that NodeJS needs to figure out where it needs to install things
- Enter
touch .bashrc
- Enter
touch .bash_profile
- Enter
- You can now create a folder for your projects
- Enter
mkdir dev
- Enter
cd dev
to change directories into the newly created “dev” directory
- Enter
- Setup Node Version Manager (NVM)
- Enter
sudo apt install curl
- Enter
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
- Close the console, reopen it, and reopen the dev folder (
cd dev
) - Enter
nvm all setup
- If this line results in an “nvm is not installed” error, you will need to manually edit your
.bash_profile
using “vi”, an old-school text editor that uses keyboard commands rather than mouse commands, to include the location of NVM. The 3 lines you need are at http://netcreate.org/documentation/#for-folks-new-to-command-line-installs and begin withexport NVM_DIR
. - First, copy and paste the 3 lines that start with
export NVM_DIR
included above in this documentation. - Then, cd to your user root directory
cd ~/
- Then type
vi .bash_profile
to open your bash shell preferences file in the program “vi” - Enter
i
(lower case I) to switch to text-insert mode. - Right-click to bring up a menu that will let you paste the 3 lines that start with
export NVM_DIR
- Press
enter
to add a line return at the end of these three lines - Press
esc
to exit out of text-insert mode and return to save/command mode - Enter
:wq!
to save, quit and go back to the command line. - Enter
exit
to exit the Digital Ocean console. - Reopen the Digital Ocean console
- Enter
cd dev
- Enter
nvm all setup
- If this line results in an “nvm is not installed” error, you will need to manually edit your
- Enter
nvm install 10.22
- Enter
nvm use 10.22
. NOTE: this is older, but it’s the one Net.Create was written with.
- Enter
Installing Net.Create
Net.Create uses GitHub to let several software developers work on its code all at once without overwriting each other.
GitHub also gives users the ability to make a local copy of the Net.Create software.
** A full installation guide is available at https://github.com/netcreateorg/netcreate-2018/wiki/Installation-Guide#download-and-run-the-source-code.**
If you are a first-time command-line user using MacOS
These directions explain in more detail each step in the “download and run the source code” section of the full installation guide
- Open Terminal on your Mac.
cd
to the project’s build directory:dev/netcreate-2018/build/
- Use the command “git” and its setting “clone” to copy the contents of the Net.Create software package from github.com to your local computer:
git clone https://github.com/netcreateorg/netcreate-2018.git
- The next step is to tell your computer which version of Net.Create you want to use. You want to use the command “git” to “checkout” or use the “dev” version of Net.Create, which is the most stable recent version of Net.Create
git checkout dev
- We need to open the directory that has the dev build of Net.Create in it
cd netcreate-2018/build
- And then we need to use node package manager “npm” to compile “ci”, or put together, a version of Net.Create that’s customized for the computer we’re currently using.
npm ci
Administering Net.Create
Starting and Stopping Net.Create
Running Net.Create has two components:
- Starting the server in the terminal
- Accessing the server from a browser
Before you start the server for the first time
The \runtime\
folder that holds your network templates, data, and network-access logs is not created automatically during the Net.Create installation process.
- On a Mac you can navigate to the build folder in your netcreate-2018 folder and make a folder called runtime.
- On Digital Ocean
cd
to thenetcreate-2018/build/
folder- Enter
mkdir runtime
Starting the server on a Mac
Note that on MacOS, the Net.Create server will stop when you put your Mac to sleep (or close the laptop lid) but restart when the Mac wakes up.
- Decide whether you are opening an existing network or creating a new network.
- If you are opening an existing network, confirm that the network has both a
.loki
and.template
file. Use the name of the network before the period.
as the dataset you are opening. - If you are creating a new network, choose a network name with no spaces in it that does not already exist.
- If you are opening an existing network, confirm that the network has both a
- Note the name of the network you will open/create. For these examples, we will use “MyNetwork” as the network name.
- In the terminal,
cd
to~/dev/netcreate-2018/build
- Enter
./nc.js --dataset=MyNetwork
- Watch for the
MAIN APP
andCLIENT APP
lines- MAIN APP will usually be http://localhost:3000
- CLIENT APP will vary based on your current IP address (the address you have been assigned on your network, which will be a string of numberS)
- In the terminal,
Starting the server on Digital Ocean
Starting and stopping the server on Digital Ocean is identical to MacOS, except that on Digital Ocean, closing the terminal will stop the Net.Create server automatically. Digital Ocean users will need a pm2 command (provided in separate documentation) to keep their server running after closing the Digital Ocean console
Stopping Net.Create
You may need to stop Net.Create because you want to control who’s editing it, or because you have a new template to load, or because you’re switching databases.
Either way, the process is simple. Go to your terminal, which should have the Net.Create logging lines printing out. Press CTRL-C
to interrupt the Net.Create process and get your command line back.
To get the previous command you typed into the terminal (the one that starts the Net.Create network you just stopped), press the up
arrow on your keyboard.