-
Notifications
You must be signed in to change notification settings - Fork 0
3 ‐ Deployment
Created from scratch with Docker, PHP8 and Symfony.
Created from scratch with Docker 20, PHP8.1 and Symfony6.2.6.
A - Create your ssh key pair follow the instructions and default option, I STRONGLY ADVISE TO PUT A PASSWORD, but it is optional:
ssh-keygen -t ed25519 -C "any_comment_you_wish_to_add"
From a command prompt on a Linux desktop environment :
If xclip can be installed :
xclip -sel clip < ~/.ssh/id_ed25519.pub
Otherwise, use cat :
cat ~/.ssh/id_ed25519.pub
From a remote connection to a server from a Windows computer, for example, print it and then copy it with your mouse or CTRL+C or CTRL+SHIFT+C :
cat ~/.ssh/id_ed25519.pub
-
Go to your account settings
-
In the access area of the summary, select SSH and GPG keys
-
Click on the button up right, "New SSH key"
-
Paste the key in the "key" input
-
Be nice and give it a name
-
Select the type of key it is, most of the time it will be an Authentication Key
-
Once everything is done, click on "Add SSH key"
wget https://github.com/kiloutyg/DocAuPoste2/releases/download/v1.02/install-docauposte2.sh
If wget is not available, you can cat
file directly, as shown at the end of this page(you'll find the whole script with the good command to use)
You can also directly clone the repo as presented later in this wiki or in the readme.md
sudo chmod +x install-docauposte2.sh
bash install-docauposte2.sh
sudo yum install git
sudo subscription-manager repo-override --repo=PlasticOmnium_Docker_Docker_CE_Stable --add=enabled:1
sudo yum update
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
sudo systemctl start docker
sudo systemctl start containerd.service
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
git clone -b develop [email protected]:kiloutyg/docauposte2
cd docauposte2
sudo chmod +x env_create.sh
./env_create.sh
3 - If Docker and Docker compose are installed already, just run (with or without sudo depending on Docker config):
docker compose up --build -d
4 - Once the app launched and IF AN ERROR ABOUT SQL appears when connecting to the app in your web browser : Then prepare Doctrine migration and then migrate :
A - Stop the docker compose stack : docker compose stop or CTRL+C
B - Re-run the building command :
docker compose up --build -d
C - Enter the app container and use the bash command prompt :
docker compose exec -ti web bash
D - Run the command to build the database :
php bin/console make:migration
php bin/console doctrine:migrations:migrate
E - Exit the container :
exit
7 - IF NEEDED : Modify the value of post_max_size and upload_max_filesize of the correct php.ini in /usr/local/etc/php respectively line 701 and 853 in the dev one, or line 703 and 855 in the production one.
####### Script to copy and paste in command prompt :
cat > install-docauposte2.sh <<'OUTER'
#!/bin/bash
# Ask the user if they have already run the app
while true; do
read -p "Are you running the app for the first Time ? (yes/no) " ANSWER;
# Check if the user answered yes or no
if [ "${ANSWER}" == "yes" ] || [ "${ANSWER}" == "no" ]; then
break
else
echo "Please answer by yes or no";
fi
done
# If the user answered yes, we install the app
if [ "${ANSWER}" == "yes" ]
then
# Install git and PlasticOmnium docker repo
sudo yum install -y git;
sudo subscription-manager repo-override --repo=PlasticOmnium_Docker_Docker_CE_Stable --add=enabled:1;
# Remove old docker version and install docker-ce
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc;
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y;
# Add the user to the docker group
sudo groupadd docker;
sudo usermod -aG docker $USER;
# Start docker and enable it inside a prompt with the docker group
sg docker -c "
sudo systemctl start docker;
sudo systemctl start containerd.service;
sudo systemctl enable docker.service;
sudo systemctl enable containerd.service;"
# Ask the user for the git repository address either in ssh or http
read -p "Address of the git repository (ssh or http // default: https://github.com/polangres/docauposte2 ) : " GIT_ADDRESS;
if [ -z "${GIT_ADDRESS}" ]
then
GIT_ADDRESS="https://github.com/polangres/docauposte2"
fi
# Clone the git repository and run the env_create.sh script
git clone ${GIT_ADDRESS};
cd docauposte2;
bash ./env_create.sh;
# Build the docker containers
sg docker -c "docker compose up --build"
else
# If the user answered no, we will ask if he wants to launch the app or if he wants to update it
while true; do
read -p "Do you wish to launch the app ? (yes/no) " LAUNCH_ANSWER;
if [ "${LAUNCH_ANSWER}" == "yes" ] || [ "${LAUNCH_ANSWER}" == "no" ]; then
break
else
echo "Please answer by yes or no";
fi
done
# If the user answered yes, we launch the app
if [ "${LAUNCH_ANSWER}" == "yes" ]; then
cd docauposte2;
sg docker -c "docker compose up"
else
while true; do
read -p "Do you wish to update the app ? (yes/no) " UPDATE_ANSWER;
if [ "${UPDATE_ANSWER}" == "yes" ] || [ "${UPDATE_ANSWER}" == "no" ]; then
break
else
echo "Please answer by yes or no";
fi
done
if [ "${UPDATE_ANSWER}" == "yes" ]; then
# Ask the user for the git repository address either in ssh or http
read -p "Address of the git repository (ssh or http // default: https://github.com/polangres/docauposte2 ) : " GIT_ADDRESS;
if [ -z "${GIT_ADDRESS}" ]
then
GIT_ADDRESS="https://github.com/polangres/docauposte2"
fi
cd docauposte2;
sg docker -c "docker compose stop";
git remote remove origin;
git remote add origin ${GIT_ADDRESS};
git fetch origin --force;
git reset --hard origin/main;
git pull --rebase origin main;
bash ./env_update.sh;
sg docker -c "docker compose up --build"
fi
fi
fi
OUTER
chmod +x install-docauposte2.sh && echo "install-docauposte2.sh script created successfully!"