This commit is contained in:
ivf
2023-06-16 19:00:35 +07:00
parent 71df048ff0
commit b1e3b40c16
4 changed files with 193 additions and 0 deletions

12
README-yarn.txt Normal file
View File

@@ -0,0 +1,12 @@
Install NodeJs
curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt-get install -y nodejs
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

View File

@@ -0,0 +1,39 @@
Backend
1. systemd one time
sudo cp systemd/backend-ivf.service /lib/systemd/system/
mkdir folders for photo ktp nikah doc
mkdir /home/ivf/project/photo-files
mkdir /home/ivf/project/ktp-files
mkdir /home/ivf/project/nikah-files
mkdir /home/ivf/project/doc-files
sudo systemctl enable backend-ivf
2. setiap update backend
sebelum update backup dan stop server
cp /home/ivf/project/backend/server /home/ivf/project/backend/server-yymmdd
stop daemond backend-ivf
sudo systemctl stop backend-ivf
cp server /home/ivf/project/backend/
* jika ada perubahan di config.yaml
cp config.yaml /home/ivf/project/backend/
start server
sudo systemctl start backend-ivf
3. Update front-end
back up existing web
pastikan file /home/ivf/project/prod_webyymmdd tidak ada
cp -r /home/ivf/project/prod_web /home/ivf/projec/prod_webyymmdd
build front-end
cd /home/ivf/project/source/ivf-ui
yarn build

125
nginx/ivf.aplikasi.web.id Normal file
View File

@@ -0,0 +1,125 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
root /home/ivf/project/web;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name ivf.aplikasi.web.id;
location /rpt/ {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8081/;
}
location /his/query {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8085/his/query;
}
location /gql/ {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080/;
}
location /file/ {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080/file/;
}
location /query {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080/query;
}
location /speedtest {
root /home/ivf/project;
}
location /xadmx {
root /home/ivf/project/adminer;
try_files $uri $uri/ =404;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/ivf.aplikasi.web.id/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/ivf.aplikasi.web.id/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = ivf.aplikasi.web.id) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name ivf.aplikasi.web.id;
listen 80;
return 404; # managed by Certbot
}

View File

@@ -0,0 +1,17 @@
[Unit]
Description=IVF Service
Wants = network-online.target systemd-networkd-wait-online.service
After = network.target
[Service]
Type=simple
WorkingDirectory=/home/ivf/project/backend/
EnvironmentFile=/home/ivf/project/backend/env
ExecStart=/home/ivf/project/backend/server
Restart=always
RestartSec=10s
StandardOutput = syslog
[Install]
WantedBy=multi-user.target