Implement issues for v1.1.0 #20

Merged
phlaym merged 24 commits from v1.1.0 into main 2023-04-07 15:07:41 +00:00
3 changed files with 37 additions and 20 deletions
Showing only changes of commit 5dd20cd6a0 - Show all commits

View File

@ -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. 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. 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 #### 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 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. 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. If you do, add the path to your SSLCertificateFile and SSLCertificateKeyFile.
Copy `moshing-mammut.service.EXAMPLE` to `/etc/systemd/system/moshing-mammut.service` 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 and set your `User`, `Group`, `ExecStart` and `WorkingDirectory` accordingly.
to run the app as.
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 #### On your development machine

View File

@ -2,14 +2,13 @@
Description=Moshing Mammut Description=Moshing Mammut
[Service] [Service]
ExecStart=/PATH_TO_MOSHING_MAMMUT/start.sh ExecStart=/home/moshing-mammut/app/start.sh
Restart=always Restart=always
User=MOSHING_MAMMUT_USER User=moshing-mammut
Group=nogroup Group=moshing-mammut
Environment=PATH=/usr/bin:/usr/local/bin Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production Environment=NODE_ENV=production
WorkingDirectory=/PATH_TO_MOSHING_MAMMUT/ WorkingDirectory=/home/moshing-mammut/app
KillMode=process
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
. /PATH_TO_YOUR_NVM/.nvm/nvm.sh . /home/moshing-mammut/.nvm/nvm.sh
node -r dotenv/config build node -r dotenv/config build