on master help sign in
Merge pull request #61 from obsidiansystems/local-server

Local deployment build

commit38cc2c5f8330eae6bb12e1e8502c1b0764739791 authorRyan Trinkle <ryan.trinkle@gmail.com> dateWed 27 Jun 2018, 14:34 (8 years ago) parent495f20c1d26a3d
5 files changed+33−10
README.md+24−5 default.nix+7−4 migration/07900e6c41ab9a78917f66fcf7e0d9b8-554c459ff2cced3e1b11241ed403890d/obelisk-handoff migration/07900e6c41ab9a78917f66fcf7e0d9b8-554c459ff2cced3e1b11241ed403890d/obelisk-upgrade skeleton/.gitignore+2−1
README.md+24−5
@@ -5,6 +5,8 @@ Obelisk provides an easy way to develop and deploy your [Reflex](https://github.
55- [Installing Obelisk](#installing-obelisk)
66- [Developing an Obelisk project](#developing-an-obelisk-project)
77- [Deploying](#deploying)
8+ - [Locally](#locally)
9+ - [EC2](#ec2)
810- [Mobile](#mobile)
911 - [iOS](#ios)
1012 - [Android](#android)
@@ -90,11 +92,28 @@ Every time you change the Haskell source files in frontend, common or backend, `
9092
9193## Deploying
9294
95+### Locally
96+
97+Build everything:
98+
99+```
100+nix-build -A exe -o result-exe
101+```
102+
103+Run the server:
104+
105+```
106+cd result-exe
107+./backend
108+```
109+
110+### EC2
111+
93112In this section we will demonstrate how to deploy your Obelisk app to an Amazon EC2 instance.
94113
95114First create a new EC2 instance:
96115
97−1. Launch a NixOS 17.09 EC2 instance (we recommend [this AMI](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-40bee63a))
116+1. Launch a NixOS 17.09 EC2 instance (we recommend [this AMI](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-40bee63a))
981171. In the instance configuration wizard ensure that your instance has at least 1GB RAM and 10GB disk space.
991181. When prompted save your AWS private key (`~/myaws.pem`) somewhere safe. We'll need it later during deployment.
1001191. Go to "Security Groups", select your instance's security group and under "Inbound" tab add a new rule for HTTP port 80.
@@ -153,7 +172,7 @@ Install Xcode 8.2 (contains iOS SDK 10.2) and open it so that it runs its post i
153172These versions will work out of the box but iOS SDKs prior to 11.3 should also work. You can choose another installed version in `default.nix`
154173
155174More recent Xcodes should also work, as long as one of the SDKs mentioned above has been used.
156−To add another SDK to your current Xcode, [download](https://developer.apple.com/download/more/) the corresponding Xcode, extract it and copy its SDK folder next to the installed one, e.g.
175+To add another SDK to your current Xcode, [download](https://developer.apple.com/download/more/) the corresponding Xcode, extract it and copy its SDK folder next to the installed one, e.g.
157176```
158177open -W Xcode_9.2.xip
159178sudo cp -R Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk
@@ -167,7 +186,7 @@ xcodebuild -showsdks
167186
168187##### Certificates
169188To deploy and/or package apps, you'll need to inform Apple of your development devices and permissions by
170−adding credentials to the correct provisioning profile via the Apple Developer portal.
189+adding credentials to the correct provisioning profile via the Apple Developer portal.
171190
1721911. Open up XCode and go to Preferences - Accounts. Select the organization
173192Member role, click Manage Certificates, and add an iOS Development
@@ -244,8 +263,8 @@ Now edit your project's `default.nix` and tell Obelisk of your app's keystore fi
244263 ...
245264 android.applicationId = "com.example.myapp";
246265 android.displayName = "My App";
247− android.releaseKey =
248− { storeFile = /path/to/myandroidkey.jks;
266+ android.releaseKey =
267+ { storeFile = /path/to/myandroidkey.jks;
249268 storePassword = "abcd1234";
250269 keyAlias = "myandroidalias";
251270 keyPassword = "abcd1234";
default.nix+7−4
@@ -297,11 +297,14 @@ rec {
297297 };
298298 };
299299 in mkProject (projectDefinition args));
300− exe = serverExe (projectOut "x86_64-linux").ghc.backend (projectOut system).ghcjs.frontend assets.symlinked configPath;
300+ serverOn = sys:
301+ serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend assets.symlinked configPath;
302+ linuxExe = serverOn "x86_64-linux";
301303 in projectOut system // {
302− inherit exe;
303− server = { hostName }: server exe hostName;
304− obelisk = import (base + "/.obelisk/impl") {};
304+ inherit linuxExe;
305+ exe = serverOn system;
306+ server = { hostName }: server linuxExe hostName;
307+ obelisk = import (base + /.obelisk/impl) {};
305308 };
306309 haskellPackageSets = {
307310 ghc = reflex-platform.ghc.override {
migration/07900e6c41ab9a78917f66fcf7e0d9b8-554c459ff2cced3e1b11241ed403890d/obelisk-handoffnew file

No changes to the content.

migration/07900e6c41ab9a78917f66fcf7e0d9b8-554c459ff2cced3e1b11241ed403890d/obelisk-upgradenew file

No changes to the content.

skeleton/.gitignore+2−1
@@ -2,5 +2,6 @@ dist-newstyle
22result
33result-android
44result-ios
5+result-exe
56.attr-cache
6−ghcid-output.txt
7+ghcid-output.txt