Fix #17 and improve instructions
This commit is contained in:
parent
8ed804a922
commit
5dd20cd6a0
46
README.md
46
README.md
@ -46,32 +46,50 @@ This might not be the ideal setup to run this, but here's how I am doing it. Ins
|
||||
or Debian derivative, using Apache as HTTP Proxy. Other setups are possible, but not covered here.
|
||||
By default, NVM is used to install NodeJS, but you can install it any way you want.
|
||||
|
||||
This is based on [SvelteKit's instructions](https://kit.svelte.dev/docs/adapter-node#deploying)
|
||||
This is based on [SvelteKit's instructions](https://kit.svelte.dev/docs/adapter-node#deploying) and [How To Deploy Node.js Applications Using Systemd and Nginx](https://www.digitalocean.com/community/tutorials/how-to-deploy-node-js-applications-using-systemd-and-nginx)
|
||||
|
||||
On your server, install the requirements:
|
||||
- Apache2 HTTP Server
|
||||
- NodeJS (via [NVM](https://github.com/nvm-sh/nvm))
|
||||
|
||||
#### On your server
|
||||
|
||||
Create a directory for the app. This will be called `$APP_DIR` from now on.
|
||||
Install Apache2 if not already installed.
|
||||
|
||||
Place `package.json`, `apache2.conf.EXAMPLE`, `moshing-mammut.service.EXAMPLE` and `start.sh.EXAMPLE` in this directory.
|
||||
Copy `apache2.conf.EXAMPLE` and `moshing-mammut.service.EXAMPLE` to your server.
|
||||
|
||||
Set up a user for the app: `useradd -mrU moshing-mammut`
|
||||
|
||||
Switch to your newly created user: `su moshing-mammut`
|
||||
|
||||
Set up NVM:
|
||||
|
||||
```
|
||||
$ cd
|
||||
$ curl https://raw.github.com/creationix/nvm/master/install.sh | sh
|
||||
$ source ~/.nvm/nvm.sh
|
||||
$ nvm install --lts
|
||||
```
|
||||
|
||||
Create a directory for the app. This will be called `$APP_DIR` from now on. I use `/home/moshing-mammut/app`.
|
||||
|
||||
Enter `$APP_DIR`.
|
||||
|
||||
Place `package-lock.json` and `start.sh.EXAMPLE` in this directory.
|
||||
Run `npm ci --omit dev` to install the dependencies.
|
||||
|
||||
|
||||
Rename `start.sh.EXAMPLE` to `start.sh` and set the path to your NVM.
|
||||
|
||||
If you do not have NVM installed, simply remove the line and make sure your node executable can be found either by
|
||||
specifying the full path or by adding it to your $PATH.
|
||||
|
||||
Exit out of your `moshing-mammut` user shell.
|
||||
|
||||
Copy `apache2.conf.EXAMPLE` to `/etc/apache2/sites-available/moshingmammut.conf` and replace `ServerName` with your
|
||||
Domain. If you do not need or want SSL support, remove the whole `<IfModule mod_ssl.c>` block.
|
||||
If you do, add the path to your SSLCertificateFile and SSLCertificateKeyFile.
|
||||
|
||||
Copy `moshing-mammut.service.EXAMPLE` to `/etc/systemd/system/moshing-mammut.service`
|
||||
and replace `/PATH_TO_MOSHING_MAMMUT` with your `$APP_DIR`. Also replace `MOSHING_MAMMUT_USER` with the user you want
|
||||
to run the app as.
|
||||
and set your `User`, `Group`, `ExecStart` and `WorkingDirectory` accordingly.
|
||||
|
||||
Rename `start.sh.EXAMPLE` to `start.sh` and replace `/PATH_TO_YOUR_NVM/.nvm/nvm.sh` with the path to your NVM
|
||||
installation.
|
||||
If you do not have NVM installed, simply remove the line and make sure your node executable can be found either by
|
||||
specifying the full path or by adding it to your $PATH.
|
||||
|
||||
Run `npm ci --omit dev` to install the dependencies.
|
||||
|
||||
#### On your development machine
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
Description=Moshing Mammut
|
||||
|
||||
[Service]
|
||||
ExecStart=/PATH_TO_MOSHING_MAMMUT/start.sh
|
||||
ExecStart=/home/moshing-mammut/app/start.sh
|
||||
Restart=always
|
||||
User=MOSHING_MAMMUT_USER
|
||||
Group=nogroup
|
||||
User=moshing-mammut
|
||||
Group=moshing-mammut
|
||||
Environment=PATH=/usr/bin:/usr/local/bin
|
||||
Environment=NODE_ENV=production
|
||||
WorkingDirectory=/PATH_TO_MOSHING_MAMMUT/
|
||||
KillMode=process
|
||||
WorkingDirectory=/home/moshing-mammut/app
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
. /PATH_TO_YOUR_NVM/.nvm/nvm.sh
|
||||
. /home/moshing-mammut/.nvm/nvm.sh
|
||||
node -r dotenv/config build
|
Loading…
Reference in New Issue
Block a user