Skip to content
Snippets Groups Projects
Commit 3d01a762 authored by James Long's avatar James Long
Browse files

Updates

parent f9c0539d
No related branches found
No related tags found
No related merge requests found
node_modules node_modules
user-files
server-files
...@@ -7,3 +7,4 @@ supervise ...@@ -7,3 +7,4 @@ supervise
bin/large-sync-data.txt bin/large-sync-data.txt
user-files user-files
server-files server-files
fly.toml
\ No newline at end of file
...@@ -10,5 +10,8 @@ ENV NODE_ENV=production ...@@ -10,5 +10,8 @@ ENV NODE_ENV=production
ADD . . ADD . .
RUN yarn install --production RUN yarn install --production
RUN mkdir ./server-files
RUN mkdir ./user-files
RUN cp ./sql/default-account.sqlite ./server-files/account.sqlite
CMD ["yarn", "start"] CMD ["yarn", "start"]
\ No newline at end of file
...@@ -28,7 +28,7 @@ You should deploy your server so it's always running. We recommend [fly.io](http ...@@ -28,7 +28,7 @@ You should deploy your server so it's always running. We recommend [fly.io](http
Next, [install the `flyctl`](https://fly.io/docs/flyctl/installing/) utility. Run `flyctl auth login` to sign into your account. Next, [install the `flyctl`](https://fly.io/docs/flyctl/installing/) utility. Run `flyctl auth login` to sign into your account.
Open `fly.toml` and customize the app name on the first line of the file. Copy `fly.template.toml` to `fly.toml`. Open `fly.toml` and customize the app name on the first line of the file.
Now, run `flyctl launch` from `actual-server`. You should have a running app now! Now, run `flyctl launch` from `actual-server`. You should have a running app now!
...@@ -36,6 +36,28 @@ Whenever you want to update Actual, update the versions of `@actual-app/api` and ...@@ -36,6 +36,28 @@ Whenever you want to update Actual, update the versions of `@actual-app/api` and
**Note:** if you don't want to use fly, we still provide a `Dockerfile` to build the app so it should work anywhere that can compile a docker image. **Note:** if you don't want to use fly, we still provide a `Dockerfile` to build the app so it should work anywhere that can compile a docker image.
### Persisting server data
One problem with the above setup is every time you deploy, it will wipe away all the data on the server. You'll need to bootstrap the instance again and upload your files.
Let's move the data somewhere that persists. With [fly.io](https://fly.io) we can create a [volume](https://fly.io/docs/reference/volumes/). Run this command:
```
flyctl volumes create actual_data
```
Now we need to tell Actual to use this volume. Add this in `fly.toml`:
```
[mounts]
source="actual_data"
destination="/data"
```
That's it! Actual will automatically check if the `/data` directory exists and use it automatically.
_You can also configure the data dir with the `ACTUAL_USER_FILES` environment variable._
## Configuring the server URL ## Configuring the server URL
The Actual app is totally separate from the server. In this project, they happen to both be served by the same server, but the app doesn't know where the server lives. The Actual app is totally separate from the server. In this project, they happen to both be served by the same server, but the app doesn't know where the server lives.
......
app = "%NAME%"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
PORT = "8080"
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 5006
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
app = "%NAME%" app = "actual-server"
kill_signal = "SIGINT" kill_signal = "SIGINT"
kill_timeout = 5 kill_timeout = 5
...@@ -11,6 +11,10 @@ processes = [] ...@@ -11,6 +11,10 @@ processes = []
allowed_public_ports = [] allowed_public_ports = []
auto_rollback = true auto_rollback = true
[mounts]
source="actual_data"
destination="/data"
[[services]] [[services]]
http_checks = [] http_checks = []
internal_port = 5006 internal_port = 5006
......
...@@ -2,10 +2,12 @@ let config; ...@@ -2,10 +2,12 @@ let config;
try { try {
config = require('./config'); config = require('./config');
} catch (e) { } catch (e) {
let fs = require('fs');
config = { config = {
mode: 'development', mode: 'development',
port: 5006, port: 5006,
files: './user-files' files: fs.existsSync('/data') ? '/data' : './user-files'
}; };
} }
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment