Running your app locally

Once baasil is installed, you can create a new app boilerplate. Just navigate to a directory of your choice (where you want the app directory to go) and then run (replacing with the name of your app):

baasil create <my-app-name>

Once it's finished, you should navigate to your app directory:

cd <my-app-name>

When you are inside an app directory, baasil will automatically find the relevant configs to run and deploy you app.

To run your app locally, you should execute the command:

baasil run

Note that this command may take a while to execute the first time (subsequent executions should take about one second).

When you execute the baasil run command, baasil will run a SocketCluster container on your local machine and will automatically attach your app directory inside it using a volume. Once it's running, you should be able to access your app from your browser using http://localhost:8000 - Port 8000 is the default, you can provide an alternative port by adding a -p <port-number> flag to the baasil command (e.g. baasil run -p 7000). doesn't currently support running SocketCluster directly with Node.js (I.e. outside of a Docker container). We plan to add this feature soon to provide better integration with IDEs and debuggers. That said, it's generally considered good practice if your local environment matches your production environment (so debugging your app/service as a Docker container has the advantage of being consistent with your production Kubernetes environment).

Once you have your app running, the next logical step is to make changes to it. You can change the backend or frontend code however you like (backend worker logic is in worker.js and your public files are in the public/ directory).

When you change a file in your project directory, the SC workers (inside the SC container) will automatically reboot with fresh code - If however, you want to reboot the entire container (not just the workers), you can use this command:

baasil restart

Now, if you go refresh http://localhost:8000, you should be able to see your changes. Note that your code will run inside a Docker container (which is running its own version of Node.js 6.3.0) - This is to keep things consistent between your development and production environment - You can interact with your container using the docker commands directly (baasil just offers shortcuts - Run baasil --help to see available commands).

To show your app's logs/output, the command is:

baasil logs

To stop your app, it's just:

baasil stop

results matching ""

    No results matching ""