Installing (Self‐hosted) - aelassas/bookcars GitHub Wiki
BookCars is cross-platform and can run and be installed on Windows, Linux and macOS.
Before we begin, make sure you have at least 1GB of SWAP memory on your server. You can add it with this script. If you add SWAP memory, you can use your own MongoDB server by installing MongoDB Community Edition.
Below are the installation instructions on Linux.
Prerequisites
-
Install git, Node.js, NGINX, MongoDB and mongosh. If you want to use MongoDB Atlas, you can skip installing and configuring MongoDB.
-
Configure MongoDB:
mongosh
Create admin user:
db = db.getSiblingDB('admin')
db.createUser({ user: "admin", pwd: "PASSWORD", roles:["root"]})
Replace PASSWORD with a strong password.
Secure MongoDB:
sudo nano /etc/mongod.conf
Change configuration as follows:
net:
port: 27017
bindIp: 0.0.0.0
security:
authorization: enabled
Restart MongoDB service:
sudo systemctl restart mongod.service
sudo systemctl status mongod.service
Instructions
- Clone BookCars repo:
cd /opt
sudo git clone https://github.com/aelassas/bookcars.git
- Add permissions:
sudo chown -R $USER:$USER /opt/bookcars
sudo chmod -R +x /opt/bookcars/__scripts
- Create deployment shortcut:
sudo ln -s /opt/bookcars/__scripts/bc-deploy.sh /usr/local/bin/bc-deploy
- Create BookCars service:
sudo cp /opt/bookcars/__services/bookcars.service /etc/systemd/system
sudo systemctl enable bookcars.service
- Create
/opt/bookcars/backend/.env
file with the following content:
# General
NODE_ENV=production
# Backend server
BC_PORT=4002
BC_HTTPS=false
BC_PRIVATE_KEY=/etc/ssl/bookcars.key
BC_CERTIFICATE=/etc/ssl/bookcars.crt
# MongoDB
BC_DB_URI="mongodb://admin:[email protected]:27017/bookcars?authSource=admin&appName=bookcars"
BC_DB_SSL=false
BC_DB_SSL_CERT=/etc/ssl/bookcars.crt
BC_DB_SSL_CA=/etc/ssl/bookcars.ca.pem
BC_DB_DEBUG=false
# Auth
BC_COOKIE_SECRET=COOKIE_SECRET
BC_AUTH_COOKIE_DOMAIN=localhost
BC_ADMIN_HOST=http://localhost:3001/
BC_FRONTEND_HOST=http://localhost/
BC_JWT_SECRET=JWT_SECRET
BC_JWT_EXPIRE_AT=86400
BC_TOKEN_EXPIRE_AT=86400
# Email (SMTP)
BC_SMTP_HOST=smtp.sendgrid.net
BC_SMTP_PORT=587
BC_SMTP_USER=apikey
BC_SMTP_PASS="PASSWORD"
[email protected]
# CDN (File storage)
BC_CDN_ROOT=/var/www/cdn
BC_CDN_USERS=/var/www/cdn/bookcars/users
BC_CDN_TEMP_USERS=/var/www/cdn/bookcars/temp/users
BC_CDN_CARS=/var/www/cdn/bookcars/cars
BC_CDN_TEMP_CARS=/var/www/cdn/bookcars/temp/cars
BC_CDN_LOCATIONS=/var/www/cdn/bookcars/locations
BC_CDN_TEMP_LOCATIONS=/var/www/cdn/bookcars/temp/locations
BC_CDN_CONTRACTS=/var/www/cdn/bookcars/contracts
BC_CDN_TEMP_CONTRACTS=/var/www/cdn/bookcars/temp/contracts
BC_CDN_LICENSES=/var/www/cdn/bookcars/licenses
BC_CDN_TEMP_LICENSES=/var/www/cdn/bookcars/temp/licenses
# Localization
BC_DEFAULT_LANGUAGE=en
# Business Rules
BC_MINIMUM_AGE=21
# Expo
BC_EXPO_ACCESS_TOKEN=EXPO_ACCESS_TOKEN
# Stripe
BC_STRIPE_SECRET_KEY=STRIPE_SECRET_KEY
BC_STRIPE_SESSION_EXPIRE_AT=82800
# PayPal
BC_PAYPAL_SANDBOX=true
BC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID
BC_PAYPAL_CLIENT_SECRET=PAYPAL_CLIENT_SECRET
# Admin
[email protected]
# Google reCAPTCHA
BC_RECAPTCHA_SECRET=RECAPTCHA_SECRET
# Misc
BC_WEBSITE_NAME=BookCars
BC_TIMEZONE=UTC # Timezone for cenverting dates from UTC to local time (used in emails sent from backend). TZ identifier https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# IPInfo (Geo lookup)
BC_IPINFO_API_KEY=IPINFO_API_KEY # Required for more than 1000 requests/day
BC_IPINFO_DEFAULT_COUNTRY=US
# Language cleanup job
BC_BATCH_SIZE=1000 # Number of documents to process per batch when deleting obsolete language values
# Sentry (Error monitoring & performance tracing)
BC_ENABLE_SENTRY=false # Set to true to enable Sentry
BC_SENTRY_DSN_BACKEND=https://[email protected]/your_project_id # Your backend DSN (keep it secret)
BC_SENTRY_TRACES_SAMPLE_RATE=1.0 # Tracing sample rate: 1.0 = 100%, 0.1 = 10%, 0 = disabled
Set the following options:
BC_DB_URI=mongodb://admin:[email protected]:27017/bookcars?authSource=admin&appName=bookcars
BC_COOKIE_SECRET=COOKIE_SECRET
BC_JWT_SECRET=JWT_SECRET
BC_AUTH_COOKIE_DOMAIN=localhost
BC_ADMIN_HOST=http://localhost:3001/
BC_FRONTEND_HOST=http://localhost/
BC_SMTP_HOST=smtp.sendgrid.net
BC_SMTP_PORT=587
BC_SMTP_USER=apikey
BC_SMTP_PASS=PASSWORD
[email protected]
BC_STRIPE_SECRET_KEY=STRIPE_SECRET_KEY
BC_RECAPTCHA_SECRET=RECAPTCHA_SECRET
BC_TIMEZONE=UTC
If you want to use MongoDB Atlas, put you MongoDB Atlas URI in BC_DB_URI
otherwise replace PASSWORD
in BC_DB_URI
with your MongoDB password. Replace JWT_SECRET
with a secret token.
Finally, set the SMTP options. SMTP options are necessary for sign up. You can use brevo or any other transactional email provider.
BC_SMTP_HOST=smtp-relay.brevo.com
BC_SMTP_PORT=587
[email protected]
BC_SMTP_PASS=PASSWORD
[email protected]
COOKIE_SECRET
and JWT_SECRET
should at least be 32 characters long, but the longer the better. You can use an online password generator and set the password length to 32 or longer.
BC_TIMEZONE
is used for cenverting dates from UTC to local time in emails. Must be a valid TZ idenfidier. Default is UTC.
Make sure the following environment variables are correctly configured in your backend/.env
file. These settings are essential for authentication to work properly. If any of them are misconfigured, login and session handling may fail.
BC_AUTH_COOKIE_DOMAIN=localhost
BC_ADMIN_HOST=http://localhost:3001/
BC_FRONTEND_HOST=http://localhost/
Replace localhost
with your actual domain name.
For example, if your admin panel is accessible at https://admin.domain.com/
, set the variables as follows:
BC_ADMIN_HOST=https://admin.domain.com/
BC_FRONTEND_HOST=https://domain.com/
BC_AUTH_COOKIE_DOMAIN=domain.com
Notes:
BC_AUTH_COOKIE_DOMAIN
should be a top-level domain (e.g.,domain.com
) — not a subdomain — to allow cookie sharing between the admin panel and frontend.- Use HTTPS in production environments (e.g.,
https://admin.domain.com/
,https://domain.com/
).
If you want to enable push notifications in the mobile app, follow these instructions and set the following option:
BC_EXPO_ACCESS_TOKEN=EXPO_ACCESS_TOKEN
If you want to use stripe payment gateway, sign up for a stripe account, fill the forms and save the publishable key and the secret key from stripe dashboard. Then, set the secret key in the following option in backend/.env:
BC_STRIPE_SECRET_KEY=STRIPE_SECRET_KEY
Don't expose stripe secret key on a website or embed it in a mobile application. It must be secret and stored securely in the server-side.
In stripe, all accounts have a total of four API keys by default-two for test mode and two for live mode:
- Test mode secret key: Use this key to authenticate requests on your server when in test mode. By default, you can use this key to perform any API request without restriction.
- Test mode publishable key: Use this key for testing purposes in your web or mobile app’s client-side code.
- Live mode secret key: Use this key to authenticate requests on your server when in live mode. By default, you can use this key to perform any API request without restriction.
- Live mode publishable key: Use this key, when you’re ready to launch your app, in your web or mobile app’s client-side code.
Use only your test API keys for testing. This ensures that you don't accidentally modify your live customers or charges.
If you want to use PayPal payment gateway instead of Stripe, you need to set:
BC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID
BC_PAYPAL_CLIENT_SECRET=PAYPAL_CLIENT_SECRET
If you want to test PayPal in sandbox mode, leave:
BC_PAYPAL_SANDBOX=true
If you want to test PayPal in production mode, set:
BC_PAYPAL_SANDBOX=false
If you want to enable HTTPS, you have to set the following options:
BC_HTTPS=true
BC_PRIVATE_KEY=/etc/ssl/bookcars.com.key
BC_CERTIFICATE=/etc/ssl/bookcars.com.crt
If you want to use Google reCAPTCHA on the frontend, you need to set:
BC_RECAPTCHA_SECRET=RECAPTCHA_SECRET
- Create
/opt/bookcars/admin/.env
file with the following content:
VITE_NODE_ENV=production
VITE_BC_API_HOST=http://localhost:4002
VITE_BC_DEFAULT_LANGUAGE=en
VITE_BC_PAGE_SIZE=30
VITE_BC_CARS_PAGE_SIZE=15
VITE_BC_BOOKINGS_PAGE_SIZE=20
VITE_BC_BOOKINGS_MOBILE_PAGE_SIZE=10
VITE_BC_CDN_USERS=http://localhost:4002/cdn/bookcars/users
VITE_BC_CDN_TEMP_USERS=http://localhost:4002/cdn/bookcars/temp/users
VITE_BC_CDN_CARS=http://localhost:4002/cdn/bookcars/cars
VITE_BC_CDN_TEMP_CARS=http://localhost:4002/cdn/bookcars/temp/cars
VITE_BC_CDN_LOCATIONS=http://localhost:4002/cdn/bookcars/locations
VITE_BC_CDN_TEMP_LOCATIONS=http://localhost:4002/cdn/bookcars/temp/locations
VITE_BC_CDN_CONTRACTS=http://localhost:4002/cdn/bookcars/contracts
VITE_BC_CDN_TEMP_CONTRACTS=http://localhost:4002/cdn/bookcars/temp/contracts
VITE_BC_CDN_LICENSES=http://localhost:4002/cdn/bookcars/licenses
VITE_BC_CDN_TEMP_LICENSES=http://localhost:4002/cdn/bookcars/temp/licenses
VITE_BC_SUPPLIER_IMAGE_WIDTH=60
VITE_BC_SUPPLIER_IMAGE_HEIGHT=30
VITE_BC_CAR_IMAGE_WIDTH=300
VITE_BC_CAR_IMAGE_HEIGHT=200
VITE_BC_MINIMUM_AGE=21
VITE_BC_PAGINATION_MODE=classic
VITE_BC_CURRENCY=\$
VITE_BC_DEPOSIT_FILTER_VALUE_1=250
VITE_BC_DEPOSIT_FILTER_VALUE_2=500
VITE_BC_DEPOSIT_FILTER_VALUE_3=750
VITE_BC_WEBSITE_NAME=BookCars
[email protected]
VITE_BC_RECAPTCHA_ENABLED=false
VITE_BC_RECAPTCHA_SITE_KEY=GOOGLE_RECAPTCHA_SITE_KEY
Set the following options:
VITE_BC_API_HOST=http://localhost:4002
VITE_BC_CDN_USERS=http://localhost:4002/cdn/bookcars/users
VITE_BC_CDN_TEMP_USERS=http://localhost:4002/cdn/bookcars/temp/users
VITE_BC_CDN_CARS=http://localhost:4002/cdn/bookcars/cars
VITE_BC_CDN_TEMP_CARS=http://localhost:4002/cdn/bookcars/temp/cars
VITE_BC_CDN_LOCATIONS=http://localhost:4002/cdn/bookcars/locations
VITE_BC_CDN_TEMP_LOCATIONS=http://localhost:4002/cdn/bookcars/temp/locations
VITE_BC_CDN_CONTRACTS=http://localhost:4002/cdn/bookcars/contracts
VITE_BC_CDN_TEMP_CONTRACTS=http://localhost:4002/cdn/bookcars/temp/contracts
VITE_BC_CDN_LICENSES=http://localhost:4002/cdn/bookcars/licenses
VITE_BC_CDN_TEMP_LICENSES=http://localhost:4002/cdn/bookcars/temp/licenses
Replace localhost
with your domain.
VITE_BC_PAGINATION_MODE
: You can choose between classic
or infinite_scroll
. This option defaults to classic
. If you choose classic
, you will get a classic pagination with next and previous buttons on desktop and infinite scroll on mobile. If you choose infinite_scroll
, you will get infinite scroll on desktop and mobile.
- Create
/opt/bookcars/frontend/.env
file with the following content:
VITE_NODE_ENV=production
VITE_BC_API_HOST=http://localhost:4002
VITE_BC_RECAPTCHA_ENABLED=false
VITE_BC_RECAPTCHA_SITE_KEY=GOOGLE_RECAPTCHA_SITE_KEY
VITE_BC_DEFAULT_LANGUAGE=en
VITE_BC_PAGE_SIZE=30
VITE_BC_CARS_PAGE_SIZE=15
VITE_BC_BOOKINGS_PAGE_SIZE=20
VITE_BC_BOOKINGS_MOBILE_PAGE_SIZE=10
VITE_BC_CDN_USERS=http://localhost:4002/cdn/bookcars/users
VITE_BC_CDN_CARS=http://localhost:4002/cdn/bookcars/cars
VITE_BC_CDN_LOCATIONS=http://localhost:4002/cdn/bookcars/locations
VITE_BC_CDN_LICENSES=http://localhost:4002/cdn/bookcars/licenses
VITE_BC_CDN_TEMP_LICENSES=http://localhost:4002/cdn/bookcars/temp/licenses
VITE_BC_SUPPLIER_IMAGE_WIDTH=60
VITE_BC_SUPPLIER_IMAGE_HEIGHT=30
VITE_BC_CAR_IMAGE_WIDTH=300
VITE_BC_CAR_IMAGE_HEIGHT=200
VITE_BC_MINIMUM_AGE=21
VITE_BC_PAGINATION_MODE=classic # classic or infinite_scroll
VITE_BC_PAYMENT_GATEWAY=Stripe # Stripe or PayPal
VITE_BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
VITE_BC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID
VITE_BC_BASE_CURRENCY=USD
VITE_BC_SET_LANGUAGE_FROM_IP=false
VITE_BC_GOOGLE_ANALYTICS_ENABLED=false
VITE_BC_GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
[email protected]
VITE_BC_DEPOSIT_FILTER_VALUE_1=250
VITE_BC_DEPOSIT_FILTER_VALUE_2=500
VITE_BC_DEPOSIT_FILTER_VALUE_3=750
VITE_BC_FB_APP_ID=XXXXXXXXXX
VITE_BC_APPLE_ID=XXXXXXXXXX
VITE_BC_GG_APP_ID=XXXXXXXXXX
VITE_BC_MIN_LOCATIONS=4
VITE_BC_WEBSITE_NAME=BookCars
VITE_BC_HIDE_SUPPLIERS=false
VITE_BC_MAP_LATITUDE=34.0268755 # Default map latitude
VITE_BC_MAP_LONGITUDE=1.6528399999999976 # Default map longitude
VITE_BC_MAP_ZOOM=5 # Default map zoom
Set the following options:
VITE_BC_API_HOST=http://localhost:4002
VITE_BC_CDN_USERS=http://localhost:4002/cdn/bookcars/users
VITE_BC_CDN_CARS=http://localhost:4002/cdn/bookcars/cars
VITE_BC_CDN_LOCATIONS=http://localhost:4002/cdn/bookcars/locations
VITE_BC_CDN_LICENSES=http://localhost:4002/cdn/bookcars/licenses
VITE_BC_CDN_TEMP_LICENSES=http://localhost:4002/cdn/bookcars/temp/licenses
VITE_BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
VITE_BC_BASE_CURRENCY=USD
[email protected]
VITE_BC_FB_APP_ID=XXXXXXXXXX
VITE_BC_APPLE_ID=XXXXXXXXXX
VITE_BC_GG_APP_ID=XXXXXXXXXX
Replace localhost
with your domain.
For Google Auth, you need to create OAuth 2.0 client ID and add your domains here and set VITE_BC_GG_APP_ID
. Do the samething for VITE_BC_APPLE_ID
here and VITE_BC_FB_APP_ID
here.
If you want to enable stripe payment gateway, set stripe publishable key in VITE_BC_STRIPE_PUBLISHABLE_KEY
. You can retrieve it from stripe dashboard.
VITE_BC_BASE_CURRENCY
is the three-letter ISO 4217 alphabetic currency code, e.g. "USD" or "EUR". Required for Stripe payments. Must be a supported currency: https://docs.stripe.com/currencies
reCAPTCHA is by default disabled. If you want to enable it, you have to set VITE_BC_RECAPTCHA_ENABLED
to true
and VITE_BC_RECAPTCHA_SITE_KEY
to Google reCAPTCHA site key.
Emails sent from the contact form are sent to:
[email protected]
If you want to enable Google Analytics, set the following options:
VITE_BC_GOOGLE_ANALYTICS_ENABLED=true
VITE_BC_GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
If you want to use PayPal payment gateway instead of Stripe, you need to set this:
VITE_BC_PAYMENT_GATEWAY=PayPal # Stripe or PayPal
VITE_BC_PAYPAL_CLIENT_ID=PAYPAL_CLIENT_ID
You can find PayPal client id in PayPal Developer Dashboard.
- If you want to use the mobile app, create
mobile/.env
file with the following content:
BC_API_HOST=https://bookcars.ma:4002
BC_DEFAULT_LANGUAGE=en
BC_PAGE_SIZE=20
BC_CARS_PAGE_SIZE=8
BC_BOOKINGS_PAGE_SIZE=8
BC_CDN_USERS=https://bookcars.ma:4002/cdn/bookcars/users
BC_CDN_CARS=https://bookcars.ma:4002/cdn/bookcars/cars
BC_CDN_LICENSES=http://bookcars.ma:4002/cdn/bookcars/licenses
BC_CDN_TEMP_LICENSES=http://bookcars.ma:4002/cdn/bookcars/temp/licenses
BC_SUPPLIER_IMAGE_WIDTH=60
BC_SUPPLIER_IMAGE_HEIGHT=30
BC_CAR_IMAGE_WIDTH=300
BC_CAR_IMAGE_HEIGHT=200
BC_MINIMUM_AGE=21
BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
BC_STRIPE_MERCHANT_IDENTIFIER=MERCHANT_IDENTIFIER
BC_STRIPE_COUNTRY_CODE=US
BC_BASE_CURRENCY=USD
BC_DEPOSIT_FILTER_VALUE_1=250
BC_DEPOSIT_FILTER_VALUE_2=500
BC_DEPOSIT_FILTER_VALUE_3=750
BC_WEBSITE_NAME=BookCars
BC_MIN_PICK_UP_HOURS=1 # Minimum required time in hours before pick-up. Default is 1 hour.
BC_MIN_RENTAL_HOURS=1 # Minimum rental duration in hours between pick up and drop off. Default is 1 hour.
Set the following options:
BC_API_HOST=https://bookcars.ma:4002
BC_CDN_USERS=https://bookcars.ma:4002/cdn/bookcars/users
BC_CDN_CARS=https://bookcars.ma:4002/cdn/bookcars/cars
BC_CDN_LICENSES=http://bookcars.ma:4002/cdn/bookcars/licenses
BC_CDN_TEMP_LICENSES=http://bookcars.ma:4002/cdn/bookcars/temp/licenses
BC_STRIPE_PUBLISHABLE_KEY=STRIPE_PUBLISHABLE_KEY
BC_STRIPE_MERCHANT_IDENTIFIER=MERCHANT_IDENTIFIER
BC_STRIPE_COUNTRY_CODE=US
BC_BASE_CURRENCY=USD
BC_CURRENCY=$
Replace https://bookcars.com
with your domain.
If you want to enable stripe payment gateway, set stripe publishable key in BC_STRIPE_PUBLISHABLE_KEY
. You can retrieve it from stripe dashboard.
BC_STRIPE_MERCHANT_IDENTIFIER
is the merchant identifier you registered with Apple for use with Apple Pay.
BC_STRIPE_COUNTRY_CODE
is the two-letter ISO 3166 code of the country of your business, e.g. "US". Required for Stripe payments.
BC_STRIPE_CURRENCY_CODE
is the three-letter ISO 4217 alphabetic currency code, e.g. "USD" or "EUR". Required for Stripe payments. Must be a supported currency: https://docs.stripe.com/currencies
- Configure NGINX:
sudo nano /etc/nginx/sites-available/default
Change the configuration as follows for the frontend:
server {
root /var/www/bookcars/frontend;
#listen 443 http2 ssl default_server;
listen 80 default_server;
server_name domain.com;
#ssl_certificate_key /etc/ssl/bookcars.com.key;
#ssl_certificate /etc/ssl/bookcars.com.pem;
access_log /var/log/nginx/bookcars.frontend.access.log;
error_log /var/log/nginx/bookcars.frontend.error.log;
index index.html;
location / {
# First attempt to serve request as file, then as directory,
# then as index.html, then fall back to displaying a 404.
try_files $uri $uri/ /index.html =404;
}
#location /cdn {
# alias /var/www/cdn;
#}
}
If you want to enable SSL, uncomment and set these lines:
#listen 443 http2 ssl default_server;
#ssl_certificate_key /etc/ssl/bookcars.com.key;
#ssl_certificate /etc/ssl/bookcars.com.pem;
Add the following configuration for the admin panel:
server {
root /var/www/bookcars/admin;
#listen 443 http2 ssl default_server;
listen 80 default_server;
server_name admin.domain.com;
#ssl_certificate_key /etc/ssl/bookcars.com.key;
#ssl_certificate /etc/ssl/bookcars.com.pem;
#error_page 497 301 =307 https://$host:$server_port$request_uri;
access_log /var/log/nginx/bookcars.admin.access.log;
error_log /var/log/nginx/bookcars.admin.error.log;
index index.html;
location / {
# First attempt to serve request as file, then as directory,
# then as index.html, then fall back to displaying a 404.
try_files $uri $uri/ /index.html =404;
}
}
If you want to enable SSL, uncomment and set these lines:
#listen 3001 http2 ssl default_server;
#ssl_certificate_key /etc/ssl/bookcars.com.key;
#ssl_certificate /etc/ssl/bookcars.com.pem;
#error_page 497 301 =307 https://$host:$server_port$request_uri;
Then, check NGINX configuration and restart NGINX service:
sudo nginx -t
sudo systemctl restart nginx.service
sudo systemctl status nginx.service
- enable firewall and open BookCars ports:
sudo ufw enable
sudo ufw allow 4002/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 3001/tcp
sudo ufw allow 27017/tcp
- Start bookcars service:
cd /opt/bookcars/backend
npm install
sudo systemctl start bookcars.service
Make sure that bookcars service is running with the following command:
sudo systemctl status bookcars.service
Make sure that the database connection is established by checking the logs with the following command:
tail -f /var/log/bookcars.log
Or this one:
sudo journalctl -xfu bookcars.service
Or by opening this file:
tail -f /opt/bookcars/backend/logs/all.log
Error logs are written in:
tail -f /opt/bookcars/backend/logs/error.log
- Deploy BookCars:
bc-deploy all
BookCars admin panel is accessible on port 3001 and the frontend is accessible on port 80.
If you want to install BookCars on a VPS with small amount of RAM, you may encounter memory issues while running bc-deploy all
. In that case, you need to proceed as follow:
- Run
bc-deploy backend
to install and run the backend server. - On your desktop PC, set up
frontend/.env
as described previously, then run the following commands fromfrontend
folder:
npm install --force
npm run build
- Copy the content of
frontend/build
from your desktop PC to/var/www/bookcars/frontend
on your VPS. - On your desktop PC, set up
admin/.env
as described previously, then run the following commands fromadmin
folder:
npm install --force
npm run build
- Copy the content of
admin/build
from your desktop PC to/var/www/bookcars/admin
on your VPS. - Restart NGINX:
sudo rm -rf /var/cache/nginx
sudo systemctl restart nginx
sudo systemctl status nginx
- If you don't want to use the demo database, create an admin user by running the following command from
backend
to create admin user:
npm run setup
It will create an admin user with the email provided in BC_ADMIN_EMAIL
in backend/.env
and B00kC4r5
as password. Change the password once you log in to admin panel.
To delete the admin user with the email provided in BC_ADMIN_EMAIL
, run the following command from backend
:
npm run reset
If you want to deploy the backend only, run the following command:
bc-deploy backend
If you want to deploy the frontend only, run the following command:
bc-deploy frontend
If you want to deploy the admin panel only, run the following command:
bc-deploy admin
If you want to deploy the admin panel and the frontend only, run the following command:
bc-deploy ui
If you want to deploy the backend, the admin panel and the frontend, run the following command:
bc-deploy all
To change the currency, follow these instructions.