- Node 18 -> curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - & sudo apt-get install nodejs
- Yarn -> npm i -g yarn
- nginx 3.1 Enable and config firewall -> ufw enable & ufw allow "Nginx HTTP"
- Clone repository: git clone https://github.com/joanob/datupv.git
- Upload database and .env files. Create .tmp folder, move data.db to datupv/server/.tmp/data.db and .env to datupv/server/.env
- Compress build and public/uploads folders and upload
- unzip folders in their location: unzip build.zip -d datupv/server (it will create /build folder)
- Install dependencies: yarn (if yarn timeouts, install some dependencies manually such as better-sqlite3)
- Build admin locally (on server takes too long): NODE_ENV=production yarn build
- Create strapi service in /etc/systemd/system/strapi.service
[Unit]
Description=strapi
[Service]
WorkingDirectory=/home/joltrablaso/datupv/server
ExecStart=NODE_ENV /home/joltrablasco/.npm-global/yarn start
Restart=no
User=joltrablasco
[Install]
WantedBy=multi-user.target
- Enable service sudo systemctl enable strapi
- Start service sudo systemctl start strapi
- Add VITE_SERVER_URL to .env with server ip (http://{ip}:1337)
- Install dependencies
- Yarn build
- Install apache2 sudo apt install apache2
- Move build to /var/www/html/datupv: mv datupv/client/dist /var/www/html/datupv
- Create config file: sudo nano /etc/apache2/sites-available/datupv.conf
<VirtualHost *:80>
ServerAdmin {user}@localhost
ServerName datupv
ServerAlias datupv
DocumentRoot /var/www/html/datupv
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Enable conf file: sudo a2ensite datupv.conf