An example project mocking a GitHub repo list that uses my full stack Clojure web app template. You should read this document top down in the order presented. When you get to Development Mode, then you may choose to instead skip that section and jump to Production Build.
- Docker
- Docker Compose
- Make (
brew install make
orapt install make
)
- Create a
.env
file in the root directory of this project. - Navigate to the root directory of this project and execute
echo 'MYSQL_ROOT_PASSWORD=<yourpassword>' >> .env
. - While still in the root directory, spin up the MySQL DB by running
make start-db
. - After a little while the MySQL DB will initialize along with Adminer; navigate to localhost:8080 and log in with the password you set in step two.
- You should now be able to see the dummy data located within two tables in the TestApp database.
The application will read the database connection info from your system environment variables. The defaults should be ok, other than the password.
Run export MYSQL_DATABASE_PASSWORD=<yourpassword>
before moving on to run the application.
Here's a full list of the database connection environment variables if you need to change them for some reason.
NAME | DEFAULT VALUE | REQUIRED |
---|---|---|
MYSQL_DATABASE_DBNAME | TestApp | No |
MYSQL_DATABASE_HOST | localhost | No |
MYSQL_DATABASE_PORT | 3306 | No |
MYSQL_DATABASE_USER | root | No |
MYSQL_DATABASE_PASSWORD | password | Yes |
MYSQL_DATABASE_POOL_SIZE | 20 | No |
Run this once
yarn webpack
Yarn and webpack are only necessary because I added literal confetti 🎉
Then run this
lein clean
lein fig:dev
Our pal Figwheel Main or Figgy Smalls as I like to call it will spin your application right up for you with auto-refresh capabilties n' all!
Wait a bit, then browse to http://localhost:9500.
But wait, there's more! I dunno about you, but I love constructing small, reusuable components that then compose the entirety of the site like lego bricks. What helps with that? Devcards!
You can view your devcards at http://localhost:9500/devcards.html.
Want to test your cljs? Visit http://localhost:9500/figwheel-extra-main/auto-testing and see your test turn from red to green!
- Same prereqs as dev
- Make sure you've run
yarn webpack
at least once prior
lein clean
lein prod
That should compile the ClojureScript code first, and then create the standalone jar which you can then run with java -jar target/my-website.jar
Your website will be awaiting you at localhost:3000
You can change the port by specifying the JETTY_PORT=<yourport>
env variable
Cheers! 🍻