Before starting backend you need to specify STABLE_DIFFUSION_API_URL in .env file. The simplest way of getting such URL is to use Google Colab:
There you start the code and copy Cloudflare URL (should look like your url is: https://xxxxxx.trycloudflare.com)
Another option is to run it locally, you have to install Python 3.9 and run it with commands (in stable-diffusion directory):
pip install -r ./requirements.txt
pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
python app.py
Alternatively, for JetBrains PyCharm users they can use green button in app.py file.
Another option is to start docker container with Dockerfile (file is in stable-diffusion folder)
docker build -t stableDiffusion
docker run -d stableDiffusion
Alternatively, for JetBrains PyCharm users they can use green triangle button on the left in Dockerfile.
WARNING: THIS OPERATION REQUIRES MORE THAN 20GB FREE SPACE ON DISK!
To start database on docker use command:
docker-compose -f docker-compose.yml up db
Alternatively, for JetBrains Intellij users they can use green button on the left in opened docker-compose file in db section.
After this you can build Spring backend locally in your environment:
mvn clean install
mvn spring-boot:run
Alternatively, for JetBrains Intellij users click green button in opened FoodzillaBackendApplication file
Before dockerizing you have to create .jar file with command:
mvn package -DskipTests
To start application within docker containers you can use created docker-compose file
docker-compose -f docker-compose.yml up
Docker-compose will automatically create database, populate it with test data and start spring backend afterwards. No further action is required, Dockerfile is only used to build spring application as the part of the docker-compose.
Alternatively, for JetBrains Intellij users they can use green button on the left in opened docker-compose file.
Start SonarQube server container on Docker
docker-compose -f docker-compose.yml up sonarqube
Login to SonarQube server on http://localhost:9000 with default credentials (admin/admin) Configure new local project and update sonar properties in pom.xml file with new project key and token
Build project
mvn clean verify sonar:sonar -Pcoverage
Check the report on http://localhost:9000
If MySQL drops error when using search endpoint, execute following query on database:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
For further reference, please consider the following sections: