Server Bug Fix: Shared files folder in Amazon Elastic Beanstalk environment

Original Source Link

I’m working on a Drupal application, which is planned to be hosted in Amazon Elastic Beanstalk environment. Basically, Elastic Beanstalk enables the application to scale automatically by starting additional web server instances based on predefined rules. The shared database is running on an Amazon RDS instance, which all instances can access properly. The problem is the shared files folder (sites/default/files).

We’re using git as SCM, and with it we’re able to deploy new versions by executing $ git aws.push. In the background Elastic Beanstalk automatically deletes ($ rm -rf) the current codebase from all servers running in the environment, and deploys the new version.

The plan was to use S3 (s3fs) for shared files in the staging environment, and NFS in the production environment. We’ve managed to set up the environment to the extent where the shared files folder is mounted after a reboot properly. But…

The Problem is that, in this setup, the deployment of new versions on running instances fail because $ rm -rf can’t remove the mounted directory, and as result, the entire environment goes down and we need restart the environment, which isn’t really an elegant solution.

Question #1 is that what would be the proper way to manage shared files in this kind of deployment? Are you running such an environment? How did you solve the problem?

By looking at Elastic Beanstalk Hostmanager code (Ruby) there seems be a way to hook our functionality (unmount if mounted in pre-deploy and mount in post-deploy) into Hostmanager (/opt/hostmanager/srv/lib/elasticbeanstalk/hostmanager/applications/phpapplication.rb) but the scripts defined in the file (i.e. /tmp/php_post_deploy_app.sh) don’t seem to be working. That might be because our Ruby skills are non-existent.

Question #2 is that did you manage to hook your functionality in Hostmanager in a portable way (i.e. by not changing the core Hostmanager files)?

Have you considered using sources via .ebextensions with your shared files stored in S3?

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

I have used sources to deploy shared files (sitemaps) that are built by our app server (and stored in S3).

sources: 
  "c:/inetpub/sitemaps": http://[S3 bucket]/sitemaps.zip

container_commands:
  01-copy-sitemaps-to-www:
    command: copy c:\inetpub\sitemaps\*.* c:\inetpub\wwwroot\ > copy_sitemaps_to_www.log 2>&1
    waitAfterCompletion: 5

S3fs is a bad idea, performance-wise, and also S3 is not designed to be mounted, it’s not a filesystem, it’s an object storage.

Use EFS instead -> https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/services-efs.html

You will see in the documentation that there is a procedure for Drupal in Beanstalk.

Regards,

Tagged : /

Code Bug Fix: How to deploy deployments in multiple nodes in kubernetes?

Original Source Link

i have a bare-metal kubernetes cluster with 1 master node and 4 worker nodes.
I want to deploy my deployment objects on every 4 worker nodes but i can’t.
I try nodeSelector but looks like it only works on last key:value pair label.

Please help me.

If you want to ensure that all nodes have that pod on them you can use a DaemonSet.

You can also use affinity/anti-affinity selectors.

Inter-pod affinity and anti-affinity allow you to constrain which nodes your pod is eligible to be scheduled based on labels on pods that are already running on the node rather than based on labels on nodes. The rules are of the form “this pod should (or, in the case of anti-affinity, should not) run in an X if that X is already running one or more pods that meet rule Y”

If you don’t want to two instances are located on the same host, check following link

https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#never-co-located-in-the-same-node

Tagged : / /

Server Bug Fix: Capistrano authentication to server fails but ssh for deploy user works

Original Source Link

I’ve been working with capistrano for about a year deploying an app and everything went fine, until a couple of days ago when I got this


** [server_name :: out] fatal: Authentication failed

after typing deploy user’s password. Trying to ssh using the same credentials works perfectly.

Do you have any idea about what could have caused this? I’m using capistrano (2.15.5) and ruby 1.9.3, and this is my Capfile:

load 'deploy' if respond_to?(:namespace) # cap2 differentiator

# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'

Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin|     load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
default_run_options[:pty] = true

Thanks a lot!

So, I figured it out. I was using HTTPS authentication for Github, but the url changed. I switched to SSH, added the public keys of the deploy user to deploy keys and everything works fine now.

Tagged : / / /

Code Bug Fix: React App deployed page looks different from localhost

Original Source Link

After working locally on my computer, I tried publishing my website for the first time using npm run deploy. When I go to the url, all the components are there but for some reason, they’re larger in dimensions than what I saw on localhost.

Here’s what it looks like locally:

Here’s what it looks like on the deployed website:

Could someone explain what’s going on here?

It looks like your localhost is zoomed out (and not the remote website). So it might explain why it looks a bit different on your localhost. Try reseting the zoom in Chrome it might solve your problem.

enter image description here

Tagged : / / /

Server Bug Fix: Can Fabric be used for auto-deploying from GitHub?

Original Source Link

Can I use Fabric to automatically deploy an app on my server every time I push the code to GitHub? (GitHub has the ability to POST to a URL every time I push.)

If so, how?

Sure. It’s not a real good idea, but it’s possible. Just setup something on a URL you control that when it receives the POST from Github, it runs your fabric script. You could use any sort of CGI/FCGI/WSGI/whatever to do this; even a couple of lines of PHP would be enough to get things underway.

Yes, There some plugins could integrate to Github. Details : https://developer.github.com/webhooks/

Also, In the Fabric side, you could trigger it by a Github web hook request. If you don’t want implement a website to do this, maybe you can try the jenkins and its plugin.

Tagged : / / /

Server Bug Fix: Tomcat – deployed .war file does not show

Original Source Link

I’m running a TomCat 7.0.11 everything worked fine, till I deployed a new .war file.
Using the manager the only message I get is

OK

but after refreshing the List of Applications no App appears. The TomCat tells me

.war file already exists

if trying to redeploy the .war

I’m not able to figure out where the problem is. Is it possible that my installation of TomCat is not compatible with Java 7?

It was a compatibility problem. Updating the TomCat did the thing. Now TomCat v. 7.0.40 is running on my server and everything works fine!

Tagged : / /

Server Bug Fix: Nginx und Tomcat For Spring and Angular App

Original Source Link

I have Spring boot and Angular app in Tomcat Container deployed on Server. It works totally fine on localhost.

Now I am trying to map my domain with the application.

When I call my domain then API calls from Angular to Spring are not getting executed.
Since they are on same server I use localhost to call the API from angular to spring.
Which works on my server browser itself but not somewhere else which is clear to me why it’s not working.

But I am not totally sure how to go around it.

API call
Here is my nginx configuration:

   server {
        listen       80;
        server_name localhost mydomain mydomain;

        
        #access_log  logs/host.access.log  main;

        location {
            root   html;
         proxy_pass      http://mydomain:8080;
            index  index.html index.htm;
        }       
    }

Tomcat configuration:

 <Host name="mydomain"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Alias>mydomain</Alias>
        <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />   
</Host>

My questions are:

  • Should I use the Server IP while calling the API from Angular to Spring? Will it work?

  • Second question is when I call my domain it redirects to tomcat manager page. I want it to go to localhost:8080/myApp.

I tried proxy_pass as http://mydomain:8080/myapp & http://localhost:8080/myapp but still no success.

Any pointers for both of these questions would be highly appreciated.
I am available here for any information.

The URL your Angular app uses to call the API should be configurable or automatically detected. So you can use:

  1. the JavaScript global location object or
  2. a similar object on the server side, like HttpServletRequest#getRequestURL(), which you’ll have to send to the Angular app (e.g. in a <script> tag).

Using the server’s IP address is tolerable, but a better solution is to use a domain name, which points at that address.

Your Tomcat installation probably has a ROOT application, which redirects to the Tomcat Manager app. You should empty it if you don’t use it (delete all files, keep the directory).

,

Tagged : / / / /

Code Bug Fix: deployed react projects showing blank

Original Source Link

I am in desperate need of help.

I have deployed my react projects for a client but when I go visit the link, it shows as a blank screen.

When I deployed to netlify, it would render fine, but now I am using hostinger, it is not showing.

I have tried adding ‘homepage”: “.”,’ to the package.json file but it didnt change anything. This seems to be a popular answer. But that didnt work, so I removed it.

Here is my package.json file:

{
  "name": "andyburnsfitness",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.28",
    "@fortawesome/free-solid-svg-icons": "^5.13.0",
    "@fortawesome/react-fontawesome": "^0.1.9",
    "axios": "^0.19.2",
    "bootstrap": "^4.5.0",
    "core-js": "^3.6.5",
    "emailjs-com": "^2.4.1",
    "nice-try": "^2.0.1",
    "nodemailer": "^6.4.6",
    "react": "^16.13.1",
    "react-animate-on-scroll": "^2.1.5",
    "react-app-polyfill": "^1.0.6",
    "react-bootstrap": "^1.0.1",
    "react-dom": "^16.13.1",
    "react-mail-form": "^2.1.0",
    "react-reveal": "^1.2.2",
    "react-router-dom": "^5.2.0",
    "react-router-scroll-top": "^0.2.1",
    "react-scripts": "2.1.8",
    "react-scroll": "^1.7.16",
    "react-scroll-to": "^3.0.0-beta.6",
    "react-simple-contact-form": "0.0.1",
    "sendmail": "^1.6.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

Here is where the URL of the website: www.acfitness.live

Your help is hugely appreciated. I am praying for an solution!

Please let me know if you require any further information

UPDATE

I have just seen that this message is in the console:

“Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: http://localhost:3000/static/js/0.chunk.js
Source Map URL: 0.chunk.js.map”

Tagged : /

Code Bug Fix: Support needed for Django app deployment on Heroku

Original Source Link

I have an app I’d like to deploy on Heroku. Not finished yet but it’s now a requirement from my teacher.
I created an account and app on heroku and use the GitHub deployment method but when I click on deploy branch I have the following type of error:

 FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_0f3c3e792cd2015b5d316aad8cf28d6c/static'
 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.
       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:
          $ heroku config:set DISABLE_COLLECTSTATIC=1
       https://devcenter.heroku.com/articles/django-assets
 !     Push rejected, 

Can you help me understand the error and solve it?

I’d like to use this deployment method if possible as I am very much a begginer in git too and I’d like to avoid doing it with CLI for now.

Thanks,

Edit: As required Requirements.txt pasted:

asgiref==3.2.3
Brotli==1.0.7
certifi==2020.4.5.1
chardet==3.0.4
dj-database-url==0.5.0
Django==3.0.3
django-crispy-forms==1.9.0
django-heroku==0.3.1
gunicorn==20.0.4
idna==2.9
psycopg2==2.8.5
pytz==2019.3
requests==2.23.0
six==1.14.0
sqlparse==0.3.0
urllib3==1.25.9
whitenoise==5.0.1

I don’t know what is the state of your settings but make sure your static urls are all created in settings.py. Specially the STATICFILES_DIRS which will set a place to collect the statics for production.

Please follow this Heroku KB:
https://devcenter.heroku.com/articles/django-assets
|

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

Then it should collect static in the right folder. Let me know.

Please use whitenoise to deploy static files on heroku.

Tagged : / / /

Server Bug Fix: GPO is applied but software is not installed

Original Source Link

I’m trying to install Zimbra Connector for Outlook via Windows Group Policy on target computers. The problem is the policy is applied to the computers but software is not installed. I’ve checked the following:

  • GPRESULT /R shows that the policy is applied to computer but the software is not installed.

  • When I use another msi installer file (other then Zimbra Connector) it is installed as expected via the same GPO.

    • I’m able to install Zimbra Connector silently as user, that is: msiexec /i \pathinstaller.msi /quiet

DC: SBS 2008

test computers: Win10 Pro x64, Win7 Pro x64.

edit:

I’ve enabled application management debug logging which gives me the error: %1605

I’ve also turned on Windows Installer verbose logging but it doesn’t create a log file.

Check RSOP.msc at the client workstation, it should provide further information.

Does the computer account have access to the share where the installer is stored?
Are there any event log entries from the Windows Installer service that would indicate the installer process failed?

Have you customised the Zimbra Connector installer as per their docs? https://zimbra.github.io/zco-docs/8.8.8/ZCS_Connector_For_Outlook_Admin_Guide.pdf (older guide https://www.zimbra.com/docs/ne/5.0.19/zcs_connector_for_outlook_guide/)

Had same issue, turns out it was permission on a file share we had relocated. The tech put “domain users” but not “domain computers”.

Tagged : / /