Last active
July 12, 2023 12:36
-
-
Save junaidulqayyumqureshi/914cd104fd2f9cc1c222f2836f4141e1 to your computer and use it in GitHub Desktop.
Research & Findings on CLOUD based website deployments, Development snippets & more
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Check processes running linux:
ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%cpu | head
AWS EC2 INSTANCE CREATION
Setting up another website in a subdirectory
server {
root /var/www/example.com;
index index.php index.html index.htm;
client_max_body_size 120M;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.html?$query_string;
}
location /blog {
root /var/www/; //Make sure that project directory is named exactly as "location /blog" i.e. /var/www/blog
try_files $uri $uri/ /blog/index.php?$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}
}
Deployment on DigitalOcean Apps Platform of a docker react app
1- Create file named "Dockerfile" (Without any extension)
2- Create folder called .docker on root and create a file in it with name "prod.Dockerfile"
Copy below content in both the files
# Use an official Node.js runtime as a parent image
FROM node:14-alpine
# Set the working directory to /app
WORKDIR /build
# Copy the package.json and package-lock.json files to the container
COPY package*.json ./
# Install the dependencies
RUN npm install
# Install the dependencies
RUN npm install -g serve
# Copy the remaining application files to the container
COPY . .
# Build the application
RUN npm run build
# Set the production environment variable
ENV NODE_ENV=production
# Expose port 3000
EXPOSE 3000
# Start the application
CMD ["serve", "-s", "build"]
3- After that, create an app on app platform and choose this repo
4- Remove extra webservice instances, if any, other than Docker WebService.
5- Define a port i.e. 3000 in settings
6- Define start and build scripts in package.json i.e. react-scripts start
Voila!!!
Recover EC2 instance & Connect without key pair
Permission Denied EC2 CodeCommit
sudo chown -R ubuntu .git/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source
PAID SSL (GoDaddy etc) - Not Lets Encrypt
Create a directory & adjust rights:
Generate 2 keys, 1 example.com.key & 2 for example.com.csr
openssl req -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr
Fill in the informations or skip by pressing enter, except Common Name FQDN etc. Provide your website name i.e example.com
2 files will be generated:
1- example.com.key
2- example.com.csr
Provide content of this csr file by copying >
cat example.com.csr
and provide to SSL provider.Once SSL zip file is downloaded from SSL Provider. Unzip it and rename with following:
1- randomnumber.crt to example.com.crt
2- xxxbundle.crt to intermediate.crt
Copy both the files to /etc/nginx/ssl
run command:
cat example.com.crt intermediate.crt > example.com.chained.crt
Then change sites-available/site to following:
Test nginx & restart by: