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

Deploy to AWS #34

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions Config/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "cryptonite" Crypto.PubKey.RSA as RSA
import Control.Exception (catch)
import qualified Data.ByteString as BS
import Web.JWT
import IHP.EnvVar

data RsaKeys = RsaKeys { publicKey :: RSA.PublicKey, privateKey :: RSA.PrivateKey }

Expand All @@ -21,9 +22,12 @@ config = do
-- Static directory.
initStaticDirStorage

jwtPrivateKeyPath <- envOrDefault "JWT_PRIVATE_KEY_PATH" "./Config/jwtRS256.key"
jwtPublicKeyPath <- envOrDefault "JWT_PUBLIC_KEY_PATH" "./Config/jwtRS256.key"

-- Private and public keys to sign and verify image style URLs.
privateKeyContent <- liftIO $ readRsaKeyFromFile "./Config/jwtRS256.key"
publicKeyContent <- liftIO $ readRsaKeyFromFile "./Config/jwtRS256.key.pub"
privateKeyContent <- liftIO $ readRsaKeyFromFile jwtPrivateKeyPath
publicKeyContent <- liftIO $ readRsaKeyFromFile jwtPublicKeyPath

case (readRsaSecret privateKeyContent, readRsaPublicKey publicKeyContent) of
(Just privateKey, Just publicKey) -> option $ RsaKeys publicKey privateKey
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ JS_FILES += ${IHP}/static/vendor/turbolinksMorphdom.js

include ${IHP}/Makefile.dist

tailwind-dev:
tailwind-dev: node_modules
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpscholten what is node_modules doing here?

Copy link
Owner Author

@amitaibu amitaibu Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess it should be npm

so it calls make npm

and I should have

npm:
	npm install

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It triggers a make node_modules when the node_modules directory doesn't exists

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we should define also:

node_modules:
     npm install

?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already defined like that (npm ci is similar to bpm install)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, moving discussion to digitallyinduced/ihp#1890

node_modules/.bin/tailwind -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --watch

node_modules:
NODE_ENV=production npm ci

static/app.css:
static/app.css: node_modules
NODE_ENV=production npm ci
NODE_ENV=production node_modules/.bin/tailwind -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --minify
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"license": "ISC",
"dependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.2"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.9"
}
}