39 lines
2.7 KiB
Plaintext
39 lines
2.7 KiB
Plaintext
Clone fork
|
|
Using git clone command
|
|
after cloning, cd into the cloned project, check if .npmrc exists. If not pause the script, ask user to add it, continue after pause
|
|
Before running setup-docker.sh script, we need to copy docker env file
|
|
inside of the project, we have this path .docker/config/.env.local, we need to copy it to project root .env file
|
|
run setup-docker.sh
|
|
Inside of cloned project, should be docker-setup.sh script, if it exists, we need to run it with sh command
|
|
If it doesn't exist, pause and notify the user, the same like we did in clone fork step
|
|
From the server copy .env -> .server.env
|
|
Using scp command, copy .env file from the server project directory, into .server.env
|
|
Mark .server.env as assume unchanged in the git repo
|
|
Modify current local .env file based on the .sever.env
|
|
We need to add APP_NAME="" from .server.env into the current .env file
|
|
Add APP_KEY from .server.env into the .env file
|
|
Create .env.prod.local from the server.env and host and user
|
|
We need following variables in the .env.prod.local
|
|
PROD_HOST="" Get this from users initial input
|
|
PROD_USER="" Get this from users initial input
|
|
PROD_DB_NAME="" Get this from .server.env (DB_DATABASE)
|
|
PROD_DB_USER="" Get this from .server.env (DB_USERNAME)
|
|
PROD_DB_PASS="" Get this from .server.env (DB_PASSWORD)
|
|
Add few helper scripts (mark them in gitignore)
|
|
I need ssh.sh script added into local project directory
|
|
Add it the same way we are doing it in sync-project.sh, by having array of scripts, then outputing variables, and then outputing the script itself
|
|
Upload lazygit to server, so that I can use ./ssh.sh --git (it opens lazygit on the server, for merging)
|
|
Now we need to add sshkey to the server
|
|
First we need to check if server has public_key and private_key already created on the server (~/.ssh/id_rsa and ~/.ssh/id_rsa.pub)
|
|
If the server has only public key, then we need to create our own private key
|
|
Create keys in our ~/.ssh/<PROJECT_NAME>
|
|
Then upload private and public key to the server, overwriting id_rsa.pub
|
|
Add our newely created id_rsa.pub to the authorised_hosts file
|
|
If server has private and public key already setup
|
|
We need to make sure id_rsa.pub is already inside of authorized_keys file
|
|
If its not then we add it there
|
|
Copy private key to our local machine into ~/.ssh/<PROJECT_NAME>
|
|
Any errors should appear in the console, with clear instructions of what happened, and what needs to be done so the script can continue. Pause the script so user can solve the issue
|
|
After that we need to use ssh-add command for our synced private key, so that we can procceed with the next step
|
|
After that we need to run php artisan db:wipe inside of running docker container
|
|
After that we can use make db-sync command to pull database from staging server |