-
Notifications
You must be signed in to change notification settings - Fork 2
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
Deploy to AWS #34
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
100bbf3
deployment attempt
AronNovak bf434bf
Some other fixes
mpscholten ffaccfd
Added configuration for JWT keys
mpscholten 3e3a8e4
upgrade ihp
AronNovak 98c426b
add dummy migration
AronNovak dad90fd
Merge remote-tracking branch 'amitai/deploy' into deploy
AronNovak 7560739
use less swap to leave space for the app
AronNovak a7e1a43
specify firewall rules
AronNovak 34c735b
attempts
AronNovak 5ba01a4
nix flake update
AronNovak 29656c0
temporarily get rid of https
AronNovak b157697
test
AronNovak 21dad89
Revert "test"
AronNovak ccce5d0
Revert "nix flake update"
AronNovak 143f731
drop https temporarily
AronNovak 365ffc9
Reapply "nix flake update"
AronNovak 41e473b
switch to fix branch
AronNovak 354f962
switch to fork
AronNovak b67d1ce
Revert "switch to fork"
AronNovak 074a946
update
AronNovak 7679690
try to generate a cert
AronNovak 880afed
fix
AronNovak 93f0af6
ssl typo
AronNovak cd7cd25
extract public key
AronNovak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
inputs = { | ||
ihp.url = "github:digitallyinduced/ihp"; | ||
ihp.url = "github:digitallyinduced/ihp/deploy-to-nixos-fixes"; | ||
nixpkgs.follows = "ihp/nixpkgs"; | ||
flake-parts.follows = "ihp/flake-parts"; | ||
devenv.follows = "ihp/devenv"; | ||
systems.follows = "ihp/systems"; | ||
}; | ||
|
||
outputs = inputs@{ ihp, flake-parts, systems, ... }: | ||
outputs = inputs@{ self, nixpkgs, ihp, flake-parts, systems, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
|
||
systems = import systems; | ||
|
@@ -35,5 +35,51 @@ | |
}; | ||
}; | ||
|
||
# Adding the new NixOS configuration for "ihp-app" | ||
flake.nixosConfigurations."ihp-app" = nixpkgs.lib.nixosSystem { | ||
system = "x86_64-linux"; | ||
specialArgs = inputs; | ||
modules = [ | ||
"${nixpkgs}/nixos/modules/virtualisation/amazon-image.nix" | ||
ihp.nixosModules.appWithPostgres | ||
({ lib, pkgs, ... }: { | ||
|
||
networking.firewall = { | ||
enable = true; | ||
allowedTCPPorts = [ 22 80 443 8000 ]; | ||
}; | ||
|
||
security.acme.defaults.email = "[email protected]"; | ||
security.acme.acceptTerms = true; | ||
|
||
services.ihp = { | ||
domain = "tpp-qa.gizra.site"; | ||
migrations = ./Application/Migration; | ||
schema = ./Application/Schema.sql; | ||
fixtures = ./Application/Fixtures.sql; | ||
sessionSecret = "M$cmzMCEx7xfL-5_q6%9cpve_0BAd5BbDaOtzhv7"; | ||
additionalEnvVars = { | ||
JWT_PRIVATE_KEY_PATH = "/root/jwtRS256.key"; | ||
JWT_PUBLIC_KEY_PATH = "/root/jwtRS256.key.pub"; | ||
}; | ||
}; | ||
|
||
swapDevices = [ { device = "/swapfile"; size = 2000; } ]; | ||
|
||
system.stateVersion = "23.05"; | ||
|
||
systemd.services.app.preStart = '' | ||
if [ ! -f /root/jwtRS256.key ]; then | ||
# Generate the private key | ||
${pkgs.openssl}/bin/openssl genpkey -algorithm RSA -out /root/jwtRS256.key -pkeyopt rsa_keygen_bits:4096 | ||
# Extract the public key from the private key | ||
${pkgs.openssl}/bin/openssl rsa -pubout -in /root/jwtRS256.key -out /root/jwtRS256.key.pub | ||
fi | ||
''; | ||
}) | ||
]; | ||
}; | ||
|
||
|
||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 thenode_modules
directory doesn't existsThere was a problem hiding this comment.
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:
?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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