How to use a single amplify backend for multiple apps in a Mono repo? - aws-amplify

I have created two react apps inside a Mono repo and I want to use a single amplify backend to the both apps. where should I amplify init in my Mono repo.

You should init Amplify at the root of your workspace.
I use Nx for managing the Monorepo, and this is my foldr structure:
amplify
apps
app1
app2
app3
amplify.yml
Check also this

Related

Trigger Amplify deplyoment for a NextJS SSR app in Gitlab Pipeline

I am deploying a NextJS SSR app in Amplify.
I am also running linters and tests in a Gitlab (cloud) Pipeline.
My workflow should be this:
Push changes into a branch.
Run the Gitlab Pipeline.
Deploy the new code (if the pipeline succeeds).
What I need is a mechanism to trigger the deployment inside the Gitlab Pipeline.
However, the documentation of Amplify says this:
Amplify Hosting does not support manual deploys for server-side rendered (SSR) apps.
That means the deployment is triggered by a push into a branch. Do you know any solution to trigger the deployment after the Gitlab Pipeline succeeded?

Initializing Firebase Functions Emulator For Correct Project

I am developing a project with Firebase backend, utilising Firebase Functions. I actually two projects: myProject and myProject-test (used for deployment testing).
When submitting API calls, my (React) front-end is configured to call the myProject-test URL when running in local development, and only direct the calls to myProject when deployed on PROD.
The problem I am facing is that when I start my cloud functions emulator using firebase emulators:start, my cloud functions get started on the localhost:5001/myProject/... url instead of localhost:5001/myProject-test/..., and hence the API calls from my local development instance never arrive.
How can I control for which project the emulators start?
This is what the firebase use command is for. Read the documentation on managing aliases. You can run the command firebase use PROJECT_ID|ALIAS to set the current project or alias that is currently use use for the emulator or other commands.

How to deploy laravel and vuejs serparately in apache server

I have an application laravel as backend and vuejs as frontend separately. The problem is I don't know how to deploy this app to the server separately using apache server. I need help please provide me a detail instructions on how to do it. I have successfully deploy the laravel application api but I'm having trouble with the vuejs frontend also I'm using one ip address for this two application.
Thanks for your help.
Donnie.
It is very simple to deploy Vue SPA on the apache server.
Run this command in your project for production build
npm run prod
OR
yarn build
This command will create a dist folder in your Vue project.
project/dist/spa
spa folder contains index.html and other files (images,css and compiled js filed)
Give path of this index.html in your apache environment.
/etc/apache2/sites-available/your_project.conf
In ubuntu look like this.
eg /var/www/dist/spa
In ubuntu how we make the symbolic link
ln -s /your_project/dist /var/www/dist

NextJS app does not recognize env variables on AWS App Runner

Good day everyone.
My issue is the following. We use a NextJS app with SSR as the Frontend for our services. We want to deploy everything on AWS App Runner via docker images. Locally the frontend container registers all env variables we have in .env.local but on App Runner all env variables turn out undefined
Of course, we don't want to use an .env file for production. We set up all env variables in the config service of App Runner and we use the NEXT_PUBLIC prefix as we should with SSR. But still nothing.
Does anyone have any suggestions on how to proceed from here?

How to setup docker-compose to work with app engine and wordpress?

I am using gitlab ci/cd to deploy my app to google app engine. I already have php instance working properly but when i try build wordpress image using docker-compose, nothing happen.
these are my files:
I have a folder "web" with a files ping.php: https://site-dot-standalone-applications.appspot.com/ping.php
So application is running into /web folder.
wordpress should be deployed into /web folder after:
docker-compose up
UPDATE
Just needed use the following gitlab-ci.yaml:
Unfortunately, you cannot (easily) deploy containers to App Engine Flex this way.
At its simplest, App Engine Flex is a service that combines a load-balancer, an auto-scaler and your docker image. Your image when run as a container is expected to provide an HTTP/S endpoint on port 8080.
There are 2 ways that App Engine could support your deployment but it does neither:
It bundles a WordPress app image and a MySQL image into a single "pod" and exposes WordPress' HTTP port on :8080. This isn't what you want because then each WordPress instance has its own MySQL instance.
It separates the WordPress app into one service and the MySQL app into another service. This is closer to what you want as you could then scale the WordPress instances independently of the MySQL instances. However, databases are the definitive stateful app and you don't want to run these as App Engine services.
The second case suggests some alternative approaches for you to consider:
Deploy your WordPress app to App Engine but use Google Cloud SQL service link.
If you don't want to use Cloud SQL, you could run your MySQL database on Compute Engine link.
You may wish to consider Kubernetes Engine. This would permit both the approaches outlined above and there are tools that help you migrate from docker-compose files to Kubernetes configurations link.
Since you're familiar with App Engine, I recommend you consider using option #1 above (Cloud SQL)

Resources