To build and start the Screenly Playground project, follow these detailed steps that provide the necessary commands and code snippets.

Prerequisites

Ensure you have the following installed before starting:

  • Node.js (v14.x or above)
  • Python (v3.7 or above)
  • Docker
  • Docker Compose

1. Clone the Repository

Begin by cloning the Screenly Playground repository from GitHub:

git clone https://github.com/screenly/playground.git

Navigate into the cloned directory:

cd playground

2. Install Node.js Dependencies

Install the required Node.js dependencies for the frontend:

npm install

3. Build the Frontend

Build the JavaScript, CSS, and HTML assets for the frontend. This usually involves a build command that is configured in your package.json. Commonly, the command looks like this:

npm run build

Check the output to ensure that build files are created in the designated output directory.

4. Configure Backend Environment

Before starting the backend, ensure that you have the necessary environment configuration.

Create a .env file based on .env.example:

cp .env.example .env

Edit the .env file to configure environment variables as needed, including database configuration, API keys, etc.

5. Install Python Dependencies

If there’s a requirements.txt file in the project directory, install required Python packages:

pip install -r requirements.txt

6. Start the Backend Server

To run the Python backend server, execute the following command:

python app.py

Ensure that the backend is running correctly by checking the logs for any errors.

7. Start the Application Using Docker

If you prefer using Docker, the project provides a Dockerfile and docker-compose.yml file for containerization. Build and start the Docker containers as follows:

docker-compose up --build

This command builds the images (if there have been any changes) and starts the containers defined in the docker-compose.yml file.

8. Accessing the Application

Once the backend and frontend are running, access the application by navigating to the following URL in your web browser:

http://localhost:3000

Make sure the port matches the port specified in your .env file or docker setup if configured differently.

9. Stopping the Services

If you are running Docker, you can stop the services with:

docker-compose down

Or if running locally, stop the Python server with Ctrl+C in the terminal where it is running.

Conclusion

Following these steps allows you to build and start the Screenly Playground project successfully. Always refer to the existing README.md or other relevant documentation in the repository for any additional configurations or troubleshooting tips specific to the project.

Information sourced from screenly/playground