Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #1

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- closed
jobs:
build-for-docker:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
env:
# define Java options for both official sbt and sbt-extras
Expand Down Expand Up @@ -34,4 +35,7 @@ jobs:
run:
npm install;
sbt docker;
docker push mattlangsenkamp/rocfreestands-http4s:latest
npm run build;
docker buildx build -f front.Dockerfile -t mattlangsenkamp/rocfreestands-front:latest .;
docker push mattlangsenkamp/rocfreestands-http4s:latest;
docker push mattlangsenkamp/rocfreestands-front:latest
80 changes: 69 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
# crossbuilds
# Rocfreestands

Install stuff
This repo contains the code used to develop [Rocfreestands](https://rocfreestands.com). The frontend is built using ScalaJS and the Tyrian framework. The backend is built using http4s, postgres, and the typelevel FP stack. The frontend and backend commuincate via rest endpoints defined using the Smithy IDL. The app is deployed to Digital ocean and netlify, through the help of docker and Github Actions

1 sbt "~fastLinkJS"
2 sbt "serverJVM/run"
3 npx tailwindcss -i ./style.css -o ./output.css; npm run dev
4 npm run dev

sbt "docker"
## Environment setup

The following tools where used to set up the development environment, if these requirements are already met this step can be skipped \
- [nvm](https://github.com/nvm-sh/nvm)
- [sdkman](https://sdkman.io/)
- [docker]()

docker compose -f stack.yml up db
docker compose -f stack.yml up -d
docker compose -f stack.yml down
```
# JS stuff
nvm install node 20
nvm use node 20
npm install

docker volume rm crossbuilds_server
# Scala stuff
sdk install java 22.3.1.r19-grl
sdk install scala 3.3.0
sdk install sbt 1.9.0
```

## Starting The Backend

### Using Docker
The fastest way to start the backend is to use Docker Compose. This will automatically start a postgres service, then the server as well as create volumes to persist data
Simply run

`docker compose -f stack.yml up -d`

To stop the services run

`docker compose -f stack.yml down`

To remove any volumes run
```bash
docker volume ls
docker volume rm <names of volumes to remove>
```

To confirm that the services started correctly navigate to http://localhost:8081/docs. The swagger documentation should be present

To change ENV variables alter them in the `stack.yml` file prior to the first time the you run `docker compose up`
### Using SBT
Even when the server is being run with SBT postgres is still run via Docker. To start just postgres run

`docker compose -f stack.yml -p dblocal up db`

Then run

`sbt "serverJVM/run"`

To confirm that the services started correctly navigate to http://localhost:8081/docs. The swagger documentation should be present

## Starting The Frontend

First make sure the backend is running as the frontend will immediately try and pull data from the backend.

To compile the frontend from scala to JS simply run

`sbt "~fastLinkJS"`

Note that the `~` enables live reloading of code changes.

To build the CSS styles defined using tailwind CSS, in a separate terminal run

`npx tailwindcss -i ./style.css -o ./output.css`

Note that this step will need to be rerun anytime a tailwind style is added

Finally, in a third terminal run

`npm run dev`
9 changes: 9 additions & 0 deletions front-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 8079;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}
9 changes: 9 additions & 0 deletions front.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM nginx:stable-alpine
COPY dist/index.html /usr/share/nginx/html
RUN mkdir "usr/share/nginx/html/assets"
COPY dist/assets/* usr/share/nginx/html/assets
COPY assets/* usr/share/nginx/html/assets
COPY front-nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 8079
CMD ["nginx", "-g", "daemon off;"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import tyrian.Html
import tyrian.Html._

def aboutPage: Model => Html[Msg] = (model: Model) =>

val images =
model.locations.map(p => img(cls := "rounded h-32 sm:h-56 w-auto m-1", src := p.location.image, onClick(Msg.NoOp)))

println("images")
println(images)
div(
cls := "font-mono text-gray-500 map p-2 pb-12 m-auto max-w-m md:max-w-3xl lg:max-w-5xl xl:max-w-7xl h-full"
)(
div(
cls := "flex p-4 mb-8 justify-center scrollbar-thin scrollbar-thumb-indigo-500 scrollbar-track-indigo-200 overflow-x-scroll"
)(img(cls := "rounded h-32 sm:h-56 w-auto m-1")),
)( images:_*),
p(
"Since the onset of covid-19 mutual aid efforts in the Rochester Area have " +
"been on the rise. One project many have invested time into is the free " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import tyrian.Html
import tyrian.Html.*
import tyrian.syntax.*

def locationDetalsPane: Model => Html[Msg] = (model: Model) =>
def locationDetailsPane: Model => Html[Msg] = (model: Model) =>

val locationPaneStyles =
"""
Expand Down Expand Up @@ -53,7 +53,7 @@ def locationDetalsPane: Model => Html[Msg] = (model: Model) =>
div(cls := "p-2 sm:flex w-full")(text("Name"), nameError),
input(
cls := Styles.inputFormClasses,
placeholder := "Enter Username",
placeholder := "Enter stand name",
onInput(name => Msg.UpdateLocationForm(model.newLocationForm.copy(name = name)))
)
),
Expand All @@ -72,7 +72,7 @@ def locationDetalsPane: Model => Html[Msg] = (model: Model) =>
div(cls := "p-2 sm:flex w-full")(text("Address"), addressError),
input(
cls := Styles.inputFormClasses,
placeholder := "Enter Address",
placeholder := "Enter address",
value := model.newLocationForm.address,
onInput(address => Msg.UpdateLocationForm(model.newLocationForm.copy(address = address)))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ object HttpHelper:

private case class Address(display_name: String)

private val clientUri = uri"http://127.0.0.1:8081/"

private val client = FetchClientBuilder[IO]
.withMode(RequestMode.cors)
.withCredentials(RequestCredentials.include)
.create
private val pubLocs =
SimpleRestJsonBuilder(PublicLocationsService).client(client).uri(uri"http://127.0.0.1:8081/").use
SimpleRestJsonBuilder(PublicLocationsService).client(client).uri(clientUri).use
private val auth =
SimpleRestJsonBuilder(AuthService).client(client).uri(uri"http://127.0.0.1:8081/").use
SimpleRestJsonBuilder(AuthService).client(client).uri(clientUri).use
private val authedLocs =
SimpleRestJsonBuilder(AuthedLocationsService).client(client).uri(uri"http://127.0.0.1:8081/").use
SimpleRestJsonBuilder(AuthedLocationsService).client(client).uri(clientUri).use

def createLocation(
nlf: LocationForm,
Expand Down Expand Up @@ -60,7 +62,6 @@ object HttpHelper:
case Right(c) =>
c.getLocations()
.map(l =>
println(l)
Msg.AddLocationsToMap(l.locations.map(LeafletHelper.locationToMapLocation))
)
Cmd.Run(io)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ object LeafletHelper:
MapLocation(location, marker)

private def setContent(location: Location): String =
println(location.uuid)
val url =
f"https://www.google.com/maps/search/?api=1&query=${location.latitude},${location.longitude}"
f"""<div class=\"inline-block break-words w-64\">
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --mode dev",
"build": "vite build --mode prod",
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAADHCAYAAAAUEcGOAAAABHNCSVQICAgIfAhkiAAAABl0RVh0U29mdHdhcmUAZ25vbWUtc2NyZWVuc2hvdO8Dvz4AAAAtdEVYdENyZWF0aW9uIFRpbWUAVGh1IDI1IE1heSAyMDIzIDA0OjI4OjQ1IFBNIEVEVDYrTV8AABhoSURBVHic7d15XFTV/8fxlywmmKiYaW6gAwKKaWmJiru2uu9Z7huoGblmbiiLmktolkvutljue5miqUBpLpiGXxeozEAEBAkGZIbz+0OdnwgMMzKXgeE8Hw8fj+ku537O9GbmbnMuQggxasQIoXJyFguCg8WO7dvFsMFDxDhfX3Ht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327Fq0UL6j0M16NgSlKeR4tly5ZlyNChAISdCuOPy5fzXFmr0bJl0yZGjhpl1Ebv3LmT5wGAZFnyPRUx8L13KV++PEC+D1X/4YdDOFapwqvNmxe4IXV6OguCg3l3wDu8068fnu4eTBg/Xg55acHyDVeFChXoN2AAAAcO7OfWrVu5ltmwbj0jRo0scCOZmZn0690H79Zt+Hrrtxw5doy5AQEc3H+AkcNHoNXITzFLpPck6rARw7G2sUar0bJh3boc8y6cP09cXCxvvV3w44aXLFqMa/36eD/2LKHefftQoUIF/rh8mT17DDvlIZUsesNVo0YNunTpCsB3W78jJSVFN2/DuvUMGTqswB34//77j80bN/Lff6l8sWKF7t/qlSupWKkSAGdOnylsP6RiqMBDu5GjR7Fn927U6el889VX+I4bR1xsHCdPnCAgOKjADVw4fwGNRkN9N3fdA6oemTPXH4BKD0MmWZYCw+XRoAHerb05dfIUmzZsZMSoUWzZvIlefXrj4OBQ4AYSExIAqFq1Ku07dCh8xVKJ8X9kY5X8nrHdjAAAAABJRU5ErkJggg==

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions server/jvm/src/main/scala/com/rocfreestands/server/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ import smithy4s.{ByteArray, Timestamp}
import smithy4s.http4s.SimpleRestJsonBuilder
import com.rocfreestands.server.database.{Flyway, SkunkSession}
import com.rocfreestands.server.middleware.JwtAuthMiddlewear
import com.rocfreestands.server.services.{
AuthServiceImpl,
LocationsRepository,
ObjectStore,
fromPath,
fromSession,
makePublicLocationService
}
import com.rocfreestands.server.services.{ObjectStore, LocationsRepository}
import com.rocfreestands.server.services.PublicLocationServiceImpl.makePublicLocationService
import com.rocfreestands.server.services.LocationsRepository.makeLocationRepository
import com.rocfreestands.server.services.ObjectStore.makeObjectStore
import com.rocfreestands.server.services.AuthServiceImpl.fromServerConfig
import com.rocfreestands.server.services.AuthedLocationServiceImpl.makeAuthedLocationService
import fly4s.core.*
Expand Down Expand Up @@ -103,8 +99,8 @@ object Main extends IOApp.Simple:
psqlConnection <- SkunkSession.fromServerConfig(serverConfig)
psqlSession <- psqlConnection
p <- createFolderIfNotExist(Path.of(serverConfig.picturePath)).toResource
im <- fromPath(p).toResource
db <- fromSession(psqlSession).toResource
im <- makeObjectStore(p).toResource
db <- makeLocationRepository(psqlSession).toResource
routes <- Routes.all(serverConfig, db, im)
srv <- EmberServerBuilder
.default[IO]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ object AuthedLocationServiceImpl:
Location(uuid, address, name, description, latitude, longitude, image, creationDateTime)
)
p <- os.writeImage(uuid, image)
l <- lr.createLocation(loc.copy(image = p.toString))
yield l
_ <- lr.createLocation(loc.copy(image = p.toString))
yield loc

override def deleteLocation(uuid: String): IO[DeleteLocationOutput] =
for
Expand Down
Loading